2626import org .axonframework .axonserver .connector .event .axon .EventProcessorInfoConfiguration ;
2727import org .axonframework .axonserver .connector .query .AxonServerQueryBus ;
2828import org .axonframework .axonserver .connector .query .QueryPriorityCalculator ;
29- import org .axonframework .commandhandling .*;
29+ import org .axonframework .commandhandling .CommandBus ;
30+ import org .axonframework .commandhandling .CommandBusSpanFactory ;
31+ import org .axonframework .commandhandling .CommandMessage ;
32+ import org .axonframework .commandhandling .DuplicateCommandHandlerResolver ;
33+ import org .axonframework .commandhandling .SimpleCommandBus ;
3034import org .axonframework .commandhandling .distributed .RoutingStrategy ;
3135import org .axonframework .common .transaction .TransactionManager ;
3236import org .axonframework .config .Configuration ;
4246import org .axonframework .extensions .multitenancy .components .queryhandeling .TenantQueryUpdateEmitterSegmentFactory ;
4347import org .axonframework .extensions .multitenancy .components .scheduling .TenantEventSchedulerSegmentFactory ;
4448import org .axonframework .messaging .interceptors .CorrelationDataInterceptor ;
45- import org .axonframework .queryhandling .*;
49+ import org .axonframework .queryhandling .QueryBus ;
50+ import org .axonframework .queryhandling .QueryBusSpanFactory ;
51+ import org .axonframework .queryhandling .QueryInvocationErrorHandler ;
52+ import org .axonframework .queryhandling .QueryMessage ;
53+ import org .axonframework .queryhandling .QueryUpdateEmitter ;
54+ import org .axonframework .queryhandling .SimpleQueryBus ;
55+ import org .axonframework .queryhandling .SimpleQueryUpdateEmitter ;
4656import org .axonframework .serialization .Serializer ;
4757import org .axonframework .spring .config .SpringAxonConfiguration ;
4858import org .axonframework .springboot .autoconfig .AxonServerAutoConfiguration ;
@@ -95,15 +105,16 @@ public TenantProvider tenantProvider(Environment env,
95105 axonServerConnectionManager );
96106 }
97107
98- private SimpleCommandBus localCommandBus (TransactionManager txManager , Configuration axonConfiguration ,
99- DuplicateCommandHandlerResolver duplicateCommandHandlerResolver ) {
108+ private SimpleCommandBus localCommandBus (TransactionManager txManager ,
109+ Configuration axonConfiguration ,
110+ DuplicateCommandHandlerResolver duplicateCommandHandlerResolver ) {
100111 SimpleCommandBus commandBus =
101112 SimpleCommandBus .builder ()
102- .transactionManager (txManager )
103- .duplicateCommandHandlerResolver (duplicateCommandHandlerResolver )
104- .spanFactory (axonConfiguration .getComponent (CommandBusSpanFactory .class ))
105- .messageMonitor (axonConfiguration .messageMonitor (CommandBus .class , "commandBus" ))
106- .build ();
113+ .transactionManager (txManager )
114+ .duplicateCommandHandlerResolver (duplicateCommandHandlerResolver )
115+ .spanFactory (axonConfiguration .getComponent (CommandBusSpanFactory .class ))
116+ .messageMonitor (axonConfiguration .messageMonitor (CommandBus .class , "commandBus" ))
117+ .build ();
107118 commandBus .registerHandlerInterceptor (
108119 new CorrelationDataInterceptor <>(axonConfiguration .correlationDataProviders ())
109120 );
@@ -124,19 +135,22 @@ public TenantCommandSegmentFactory tenantAxonServerCommandSegmentFactory(
124135 DuplicateCommandHandlerResolver duplicateCommandHandlerResolver
125136 ) {
126137 return tenantDescriptor -> {
127- SimpleCommandBus localCommandBus = localCommandBus (txManager , axonConfiguration , duplicateCommandHandlerResolver );
128- AxonServerCommandBus commandBus = AxonServerCommandBus .builder ()
129- .localSegment (localCommandBus )
130- .serializer (messageSerializer )
131- .routingStrategy (routingStrategy )
132- .priorityCalculator (priorityCalculator )
133- .loadFactorProvider (loadFactorProvider )
134- .spanFactory (axonConfiguration .getComponent (CommandBusSpanFactory .class ))
135- .targetContextResolver (targetContextResolver )
136- .axonServerConnectionManager (connectionManager )
137- .configuration (axonServerConfig )
138- .defaultContext (tenantDescriptor .tenantId ())
139- .build ();
138+ SimpleCommandBus localCommandBus = localCommandBus (txManager ,
139+ axonConfiguration ,
140+ duplicateCommandHandlerResolver );
141+ AxonServerCommandBus commandBus =
142+ AxonServerCommandBus .builder ()
143+ .localSegment (localCommandBus )
144+ .serializer (messageSerializer )
145+ .routingStrategy (routingStrategy )
146+ .priorityCalculator (priorityCalculator )
147+ .loadFactorProvider (loadFactorProvider )
148+ .spanFactory (axonConfiguration .getComponent (CommandBusSpanFactory .class ))
149+ .targetContextResolver (targetContextResolver )
150+ .axonServerConnectionManager (connectionManager )
151+ .configuration (axonServerConfig )
152+ .defaultContext (tenantDescriptor .tenantId ())
153+ .build ();
140154 commandBus .start ();
141155 return commandBus ;
142156 };
0 commit comments