GithubHelp home page GithubHelp logo

axon-command-idempotency's Introduction

Idempotency of command handlers in Axon Framework

  • Command failures are often transient (e.g. service down -> NoHandlerForCommandException). As such, it makes sense to introduce the concept of a RetryScheduler
  • Problem: retrying commands is not always a safe operation, as the initial "failed" command may have produced side effects
    • this is particularly common in case of timeout (COMMAND_TIMEOUT("AXONIQ-4002", Status.CANCELLED, HttpStatus.GATEWAY_TIMEOUT))
  • To enable safe retries, the CH must be idempotent
    • Some operations are inherently idempotent (e.g. markDeleted())
    • Many operations are not inherently idempotent (e.g. DepositMoney)
    • All operations can be made idempotent by adding a uniquifier (see Building on Quicksand by Pat Helland)
  • ApplicationIT demonstrates that, in the absence of a uniquifier, the use of a RetryScheduler can cause side effects to be triggered multiple times.
    • the test fails when using org.axonframework:axon-spring-boot-starter:4.6.2 (git checkout e2ff3a8e523888da98f4f4d749fcc985d2229cd5 && mvn verify)
    • the test still fails after replacing org.axonframework:axon-spring-boot-starter:4.6.2 (git checkout 605660d798036ea3ccbbd4c35e6c4620840262c3 && mvn verify) with com.github.jvanheesch.AxonFramework:axon-spring-boot-starter:8de17c281d890a4598d640c788aad4557c7ef787
    • the test passes after adding idempotent = true to @Aggregate for BankAccount aggregate (git checkout 804754d41a78fdfb41880b30a16ddccca8cbe8e3 && mvn verify)

axon-command-idempotency's People

Contributors

jvanheesch avatar

Stargazers

Silvano avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.