hi Allard/Steven,
im getting exception shown below, if im dispatching command which is handled in other service if i am using AsynchrnousCommansdBus/DisruptorCommandBus.
if i use default CommandBus(SimpleCommandBus) the command is dispatched from ServiceA and handled in ServiceB successfully without exception.
below is code snippet of my configuration in ServiceA.
@Bean(destroyMethod="shutdown")
@ConditionalOnMissingBean
public AsynchronousCommandBus commandBus(TransactionManager txManager, AxonConfiguration axonConfiguration) {
AsynchronousCommandBus commandBus =
AsynchronousCommandBus.builder()
.transactionManager(txManager)
.messageMonitor(axonConfiguration.messageMonitor(AsynchronousCommandBus.class, "commandBus"))
.build();
commandBus.registerHandlerInterceptor(new CorrelationDataInterceptor<>(axonConfiguration.correlationDataProviders()));
return commandBus;
}
@Bean
public CommandGateway commandGateway(AsynchronousCommandBus commandBus){
/*Configurer configurer = DefaultConfigurer.defaultConfiguration();
CommandBus commandBus = configurer.buildConfiguration().commandBus();*/
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
RetryScheduler rs = IntervalRetryScheduler.builder().retryExecutor(scheduledExecutorService).maxRetryCount(5).retryInterval(1000).build();
CommandGateway commandGateway = DefaultCommandGateway.builder().commandBus(commandBus).retryScheduler(rs).build();
return commandGateway;
}
below is the exception stack-trace.
2020-06-29 11:59:54.397 INFO 7572 — [unt.handlers]-0] c.u.account.aggregate.AccountAggregate : Inside Create Account Process Event in CreateAccountaggregate
2020-06-29 11:59:54.403 INFO 7572 — [agaProcessor]-0] c.u.account.saga.AccountSaga : Inside AccountProcessEvent in Account MMT SAGA
2020-06-29 11:59:54.403 INFO 7572 — [agaProcessor]-0] c.u.account.saga.AccountSaga : Saga invoked for AccountProcessEvent
2020-06-29 11:59:54.403 INFO 7572 — [agaProcessor]-0] c.u.account.saga.AccountSaga : Account global id XXXXXXXXXXXXXXXXXXX
2020-06-29 11:59:54.403 INFO 7572 — [agaProcessor]-0] c.u.account.saga.AccountSaga : Fire Create Account Command In DB IN ServiceB
2020-06-29 11:59:54.410 INFO 7572 — [agaProcessor]-0] o.a.c.gateway.AbstractRetryScheduler : Processing of Command [CreateInDBCommand] resulted in an exception. Will retry 4 more time(s)… Exception was org.axonframework.commandhandling.NoHandlerForCommandException, No handler was subscribed to command [com.core.commands.CreateInDBCommand]
2020-06-29 11:59:55.411 INFO 7572 — [pool-1-thread-1] o.a.c.gateway.AbstractRetryScheduler : Processing of Command [CreateInDBCommand] resulted in an exception. Will retry 3 more time(s)… Exception was org.axonframework.commandhandling.NoHandlerForCommandException, No handler was subscribed to command [com.core.commands.CreateInDBCommand]
2020-06-29 11:59:56.414 INFO 7572 — [pool-1-thread-1] o.a.c.gateway.AbstractRetryScheduler : Processing of Command [CreateInDBCommand] resulted in an exception. Will retry 2 more time(s)… Exception was org.axonframework.commandhandling.NoHandlerForCommandException, No handler was subscribed to command [com.core.commands.CreateInDBCommand]
2020-06-29 11:59:57.416 INFO 7572 — [pool-1-thread-1] o.a.c.gateway.AbstractRetryScheduler : Processing of Command [CreateInDBCommand] resulted in an exception. Will retry 1 more time(s)… Exception was org.axonframework.commandhandling.NoHandlerForCommandException, No handler was subscribed to command [com.core.commands.CreateInDBCommand]
2020-06-29 11:59:58.417 INFO 7572 — [pool-1-thread-1] o.a.c.gateway.AbstractRetryScheduler : Processing of Command [CreateInDBCommand] resulted in an exception. Will retry 0 more time(s)… Exception was org.axonframework.commandhandling.NoHandlerForCommandException, No handler was subscribed to command [com.core.commands.CreateInDBCommand]
2020-06-29 11:59:59.440 INFO 7572 — [pool-1-thread-1] o.a.c.gateway.AbstractRetryScheduler : Processing of Command [CreateInDBCommand] resulted in an exception 6 times. Giving up permanently.
org.axonframework.commandhandling.NoHandlerForCommandException: No handler was subscribed to command [com.progressivecoder.ecommerce.commands.CreateInDbCommand]
at org.axonframework.commandhandling.SimpleCommandBus.doDispatch(SimpleCommandBus.java:146) [axon-messaging-4.2.jar:4.2]
at org.axonframework.commandhandling.SimpleCommandBus.dispatch(SimpleCommandBus.java:111) [axon-messaging-4.2.jar:4.2]
at org.axonframework.commandhandling.gateway.RetryingCallback$RetryDispatch.run(RetryingCallback.java:120) [axon-messaging-4.2.jar:4.2]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_201]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_201]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
2020-06-29 11:59:59.441 WARN 7572 — [pool-1-thread-1] o.a.c.gateway.DefaultCommandGateway : Command ‘com.core.commands.CreateInDBCommand’ resulted in org.axonframework.commandhandling.NoHandlerForCommandException(No handler was subscribed to command [com.core.commands.CreateInDBCommand])
is that i am missing any configuration?
Any suggestion may be helpful.
Thanks
Siddu
exception.txt (4.07 KB)