Class MigrateCommandGatewayInSagaEventHandler
- All Implemented Interfaces:
Cloneable
CommandGateway field in legacy Saga event handlers to
an Axon Framework 5 CommandDispatcher method parameter.
The recipe acts when a @SagaEventHandler, or a @DeadlineHandler of a Saga, uses the gateway,
directly or through the methods it calls; an aggregate's deadline handler is left alone. The dispatcher parameter
is resolved before the payload, so even as the only parameter of a deadline handler it does not become the payload.
The recipe preserves the dispatch contract of each call. send(...) remains fire-and-forget.
sendAndWait(...) waits through FutureUtils.joinAndUnwrap(...) so the Saga handler remains
synchronous and command failures retain their original exception type. When no references remain, the obsolete
gateway field and its constructor injection are removed, together with an @Autowired or @Inject
setter that only assigns the field, which the legacy module does not call. A call of that setter, or a method
reference to it, keeps the field and the setter in place.
- Since:
- 5.4.0
- Author:
- Mateusz Nowak
-
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
-
MigrateCommandGatewayInSagaEventHandler
public MigrateCommandGatewayInSagaEventHandler()
-
-
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
-