Distributed Subscription Query Updates in Multi-Node Environments

Dear Axon Community,

We are currently exploring the use of Axon Subscription Queries in a multi-node deployment. We have observed that the default behavior for query update events is limited to a single JVM instance.

I recently came across an old discussion from six years ago (QueryUpdateEmitter on Multi-Noded Environment) that addresses a similar issue. I would like to know if there have been any recent developments on this matter, or if anyone has implemented alternative approaches.

I have also noticed that there is an open issue regarding the implementation of a distributed query bus, which has recently been prioritized (Distributed Query Bus · Issue #613 · AxonFramework/AxonFramework · GitHub). I am curious if there is an estimated timeline for its implementation.

Thank you for your insights

As far as I know, the only distributed query bus implementation is included in Axon Server. I don’t see an easy way to have something similar without Axon Server.

We faced a similar issue. Rather than trying to implement a whole new query bus, I hacked a solution together by gluing on a component that uses LISTEN/NOTIFY in Postgres to communicate across nodes, and then subscription queries to communicate within the confines of a single node. It’s not beautiful, but it works.

You should be aware however that there are multiple additional problems with subscriptions queries, not the least of which is that they contain bugs which make them crash and/or leak memory when not used in a very specific way. I’d personally advise against using them.

Are there already GitHub issues for those bugs? Would be great to add them in a way that can be reproduced. I didn’t ran into any bugs using subscriptions. It also depends a lot on how you implement them, since they are statefull, there is a risk of memory that won’t be released.

I did put together a comprehensive test suite that documents the behavior. It won’t be runnable in a vanilla project without some changes, since it uses some of our internal configuration classes, but that’s just stuff needed to make it work in our environment and has nothing to do with the stuff its testing.

We’ve made the decision to move away from Axon, so I unfortunately don’t have too much time I can spend on this. Would you like me to open a github issue, or post it here?

Both would be fine and extremely helpful, Gabriel!
I am very curious what issues you and the team hit. Although I know we had subscription-query predicaments in the past, I have heard very little recent issues with them.

However, I am completely fine with being proven wrong. If we can improve Axon’s tooling, I am all for it.

As a side note, would you be able to share why you and the team moved away from Axon? Input like that may just help future users since it may influence our API and/or our documentation. Thanks in advance, @Gabriel_Shanahan! :pray:

I believe that for Axon Framework 5, there will be a form of Distributed Query Bus besides Axon Server. I think it’s about time there is one… Granted, that’s no clear timeline. At this stage of the AF5 development cycle, it is tough to state an actual date any other than soon.

1 Like