Axon Java Distributed CommandBus with SpringCloud and Eureka

Hi All,
I am trying to configure distributed command bus with Spring Cloud and Eureka in Java.
There are 3 projects at GitHub - isuru-sam/axonspringcloud.

  • Axon euraka server http://localhost:8761/
  • Axon euraka client 1 GiftCardEurekaClient 8080
  • Axon euraka client 2 GiftCardEurekaClient2 8081

GiftCardEurekaClient http://localhost:8080/api/issuecard should invoke IssueCardCommand local command first and then it will invoke UpdateCustomerComamnd running on port 8081 on GiftCardEurekaClient2.

How ever exception is thrown when commandGateway.send(commandGateway.send(new UpdateCustomerCommand("1","updated"))); is invoked from GiftCardEurekaClient.UpdateCustomerCommand handler is running in GiftCardEurekaClient2.
Why there is exception when attempt is made to delegate the command to remote GiftCardEurekaClient2?

org.axonframework.messaging.annotation.MessageHandlerInvocationException: Error handling event of type [class com.axon.axoneurakaclient.event.CardIssuedEvent] in aggregate
	at org.axonframework.modelling.command.inspection.AnnotatedAggregateMetaModelFactory$AnnotatedAggregateModel.lambda$doPublish$17( ~[axon-modelling-4.5.jar:4.5]
	at java.base/java.util.Optional.ifPresent( ~[na:na]

Please go through the code at GitHub - isuru-sam/axonspringcloud and clarify why command delegation is not happening?


The framework throws this exception if the command handler throws a IllegalAccessException, InvocationTargetException or InstantiationException. As you haven’t shared the rest of the stack trace, it is hard to deduce which of these is the culprit.

At any point, I do not believe the problem has anything to do with using Axon’s Spring Cloud extension. Rather there is something amiss in the command handler or an event sourcing handler invoked as a follow-up of handling the command.