HashChangeListener equivalent in Axon 3.1?

Now that Axon 3.1 is released, I'm having another crack at porting our Axon 2 application. Our application runs in a JGroups cluster using JGroupsConnector and a distributed command bus. There is some application logic that runs as nodes become eligible and ineligible for command handling. In Axon 2, I could pass a HashChangeListener argument to the JGroupsConnector constructor, but HashChangeListener appears to have been removed and it's not clear to me what the equivalent would be.

The "Command Dispatching" page in the manual alludes to it being possible ("Note: When using a Cache, it should be cleared out when the ConsistentHash changes," which implies there is some way to know when the ConsistentHash changes) but doesn't say how. Looking at the JGroupsConnector code I don't see an obvious hook to use, but I may be looking in the wrong place.

Thanks!

-Steve

Hi Steven,

I was pretty sure it was there, but can’t find it either. It must have slipped through the cracks somewhere during the redesign of the DistributedCommandBus and its connectors in Axon 3.0.
We’ll add the feature back in for the next release.

Cheers,

Allard

Hi Steven,

there is a workaround, not very beautiful, but is should work.
If you subclass JGroupsConnector, and override the “viewAccepted” and “receive” methods, you can compare the ConsistentHash before the invocation to the one after. On the receive method, you would only have to do so when “message instanceof JoinMessage”. Those are the two reasons that can change the ConsistentHash.

Cheers,

Allard