Package org.axonframework.migration
Class MigrateCommandGatewayInSagaEventHandler
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.MigrateCommandGatewayInSagaEventHandler
- All Implemented Interfaces:
Cloneable
public class MigrateCommandGatewayInSagaEventHandler
extends org.openrewrite.Recipe
Migrates command dispatch from an Axon Framework 4
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.
- 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
-