We have developed a microservice backend using Axon. We have polymer, angular as well as pure java clients accessing the service. For availability purposes we are going to cluster it using 4 nodes behind a load balancer. Given that there are concurrency requirements (same AR modified by different clients at the same time), we will need to configure axon using jgroups to coordinate commands. So far so good, all known territory.
However: certain commands actually should send a meaningful response to the client: for example when AR is updated -> we send back a list of ‘valid’ items for that the AR. Until now, this response content was derived in the @EventHandler methods and set as a threadlocal, so that the RestController could pick it up and return it to the client. With jgroups this is obviously not going to work anymore. So I am wondering how other people are handling this ? A few options are
make the @CommandHandler derive and return this information. It seems not the most natural way, and currently the AR does not even contain all data required for this.
use sse, and try to connect the client with the handling node of the eventhandler, seems to complicate things unnecessarily IMO
derive the return payload in the restcontroller, after the command dispatching and event handling is complete.
Any other suggestions how people handle this ?