jms - Generate Client ID on deploy -
i have wildfly cluster should share topic messages different nodes , keep them if 1 node offline.
 case 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 using same clientid system doing load-balancing. if change clientid or subscriptionname unique value works.
so when use unique clientid , when subscriptionname?
 answer was, unique clientid per node , subscriptionname per thread on node.
furthermore want generate clientid based on wildfly node name similar to:
@activationconfigproperty(propertyname = "clientid", propertyvalue = "abcd-" + wildfly.getinstance().getnodename()),   is there way achieve it?
there real simple solution available: property replacement
you need enable in standalone.xml:
<subsystem xmlns="urn:jboss:domain:ee:2.0">     <annotation-property-replacement>true</annotation-property-replacement>     ... </subsystem>   and new annotation can following:
@messagedriven(     activationconfig = {         @activationconfigproperty(propertyname = "destinationtype", propertyvalue = "javax.jms.topic"),         @activationconfigproperty(propertyname = "destination", propertyvalue = "jms/topic"),         @activationconfigproperty(propertyname = "subscriptiondurability", propertyvalue = "durable"),         @activationconfigproperty(propertyname = "subscriptionname", propertyvalue = "aname"),         @activationconfigproperty(propertyname = "clientid", propertyvalue = "abcd-${jboss.node.name}"),     } )      
Comments
Post a Comment