I have a WildFly cluster which should share all topic messages to different nodes and keep them if one node is offline.
For this case I need durable subscriper.
@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "anam123e"),
@ActivationConfigProperty(propertyName = "clientID", propertyValue = "abcd"),
}
)
I have noticed if I am using the same clientID the system is doing load-balancing. If I change the clientID or subscriptionName to an unique value it works.
So when to use a unique clientID and when subscriptionName?
My answer was, unique clientID per Node and subscriptionName per Thread on a Node.
Furthermore I want to generate a clientID based on the wildfly node name similar to:
@ActivationConfigProperty(propertyName = "clientID", propertyValue = "abcd-" + WildFly.getInstance().getNodeName()),
Is there a way to achieve it?