MDB for clustered JMS topic doesn't deploy?
t.gueldner Jun 27, 2013 7:13 AMHi,
I want to use a JMS topic to notify all nodes of a cluster about an event.
My JBoss AS 7.1.3 has a clustered messaging module. Queues are working fine and are load balanced.
My MDB for the topic has the following configuration:
{code}
@MessageDriven(name= "CamelMDB", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/topic/testTopic"),
@ActivationConfigProperty(propertyName = "reconnectAttempts", propertyValue = "-1"),
@ActivationConfigProperty(propertyName = "setupAttempts", propertyValue = "-1"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
{code}
Deploying this MDB to node1 works fine. Depoying this MDB to node 2 results in two messages:
Node 1 removes a HornetQ-Cluster connection:
{quote}2013-06-27 10:19:45,052 INFO (Thread-65 (HornetQ-client-global-threads-2074138690)) Removing clusterName=...{quote}
Node 2 is trying to connect to the jms topic:
{quote}2013-06-27 12:06:49,496 INFO [org.hornetq.ra.inflow.HornetQActivation] (default-threads - 2) Attempting to reconnect or g.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@2574e2b6 destination=jms/topic/testTopic
destinationType=javax.jms.Topic ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
2013-06-27 12:06:52,471 INFO [org.hornetq.ra.inflow.HornetQActivation] (default-threads - 2) awaiting topic/queue creation jms/topic/testTopic
{quote}
Another approach would be to configure the MDB as a durable subscriber adding this config parameters:
{code}
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "consumer")
{code}
This works fine for node 1. Node 2 will raise an error in reason of duplicate clientId. To avoid duplicate clientIds I have to modify the code of my MDB and can't deploy the same artefact on different nodes. This is strange and definitely not thw way I want.
What is the best solution? Durable or non durable subscription doesn't matter.