Sharing Command Bus Between Different Spring Application Contexts

I’m considering how to modularise an application so that I can have a separate war file for each business module. Each module would have command handlers to process events of that business function. The modules need to share a common command bus.

If the module war files all reside on the same Jboss server then I am wondering which command bus to use and how best to configure that with spring?

I understand that the default command bus is specific to a single jvm instance, so how do I accesss that from different Spring application contexts. Should I be thinking of a specific module that configures the commad bus and then perform some lookup from the other module application contexts?

Later I may wish to deploy further modules on an additional Jboss server. Is there a way to use the same command bus locally and later on distributed across two servers?

Many Thanks

Hi Magnus,

currently, the DistributedCommandBus implementation is the only one that can be used across VM’s. Since your application server most likely starts a VM per application, the only way to go is the DistributedCommandBus. If your VM’s are on the same physical machine, you’ll have some serialization overhead (which is unavoidable when sharing data between VM’s), but won’t suffer from network latency (as much).

Cheers,

Allard