Unable to register JGroups channel for JMX


I’m using Axon framework 3.3.6 with Spring Boot 1.5.18, and I have a distributed command bus with JGroups.

Now I’m trying to expose JGroups channel via JMX but can’t find an elegant way. The only way that I’ve found is to somehow set a registerMBean property on JGroupsConnectorFactoryBean instance.
Unfortunately, I can not found an easy way.

I’m either missing exposed property on DistributedCommandBusProperties.JGroupsProperties or easy access to created JGroups channel. I would prefer the second options since it offers more
possibilities about the timing and configuration of JMX registration.

I even quickly glanced over the latest Axon code on Github, but it looks like that situation is the same.

Please advise. Am I missing something?

Damir Murat

Hello Damir,

the most elegant way at the moment, is probably to define your own JGroupsConnector or JGroupsConnectorFactoryBean in your application context. Instead of using setConfiguration, you could use the setChannelFactory(…) method. This method was added at the time to allow more fine grained control on how a channel needs to be created.

You can create an implementation of a ChannelFactory that delegates to an existing one, and adds the JMX registration logic to the channel returned from the instance you delegated to.

In the meantime, yes, I agree that exposing the Channel would be a cleaner option. We’ll look into that.