Package org.axonframework.migration
Class MarkDeadlineManagerCallsInCallbacks
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.MarkDeadlineManagerCallsInCallbacks
- All Implemented Interfaces:
Cloneable
public class MarkDeadlineManagerCallsInCallbacks
extends org.openrewrite.Recipe
Leaves a
// TODO(axon4to5): marker on the Saga statements that use a DeadlineManager inside an
asynchronous callback, which no longer works on the Axoniq Framework legacy module.
Axon Framework 4 offered one global DeadlineManager, so a Saga could schedule or cancel a deadline from any
thread, for example once a command result arrived. The legacy module binds the DeadlineManager a Saga handler
receives to that handler's processing context, and runs its calls when that context commits. A call from a callback
that runs after the handler returned throws an IllegalStateException, which a whenComplete(..)
callback or a Reactor subscriber drops, so the deadline is silently never scheduled or cancelled.
In a Saga, being a class with the Spring @Saga stereotype or a @SagaEventHandler method, the recipe
marks each statement that:
- passes a lambda, method reference or anonymous class that uses the
DeadlineManagerto a method ofCompletionStage, such aswhenComplete(..), or of a ReactorMonoorFlux; - ends a Reactor chain in
subscribe(..)and passes theDeadlineManageron to another call in the arguments of one of the chain's operators, such asflatMap(helper(deadlineManager)).
DeadlineManager means calling one of its methods, or passing it on to another method or
constructor. The fix, waiting for the result inside the handler before calling the DeadlineManager, depends
on the application, so the code is kept as is. The marker goes on the enclosing statement, so it lands above the
chain holding the callback. Runs on the Axon Framework 4 DeadlineManager type, which the legacy module keeps
in its package. Java sources only. Idempotent.- Since:
- 5.4.1
- Author:
- Stefan Dragisic
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openrewrite.Recipe
org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe -
Field Summary
Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.openrewrite.TreeVisitor<?, org.openrewrite.ExecutionContext> Methods inherited from class org.openrewrite.Recipe
addDataTable, aggregateDataTableDescriptors, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions
-
Constructor Details
-
MarkDeadlineManagerCallsInCallbacks
public MarkDeadlineManagerCallsInCallbacks()
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Specified by:
getDescriptionin classorg.openrewrite.Recipe
-
getVisitor
public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-