3 Replies Latest reply on Jun 15, 2009 5:46 PM by mhossein

    getting messages on one node of cluster

      Hi:

      We have a subsystem that should run only on one node (I'll call it the master node) of our cluster (right now, it's the coordinator of the cluster). We need to be able to send messages to a queue or topic from every node but we only want the node that runs the above mentioned service (the master node) to pick up those messages. (we use JBoss messaging and clustered queues for many other subsystems so we cannot set up JBoss messaging in a non-clustered way).

      I originally thought that in this case, I can have that single node to subscribe to the queue programatically (instead of using MDBs) to achieve my goal. But it turned out that it's against J2EE spec to register a listener using setMessageListener inside an app server. On the other hand, if I use MDBs it means that any node may pick up any message.

      Is there a way to do this? I have a few ideas but I'm not sure if they make sense or if they are at all possible:

      1- Create the queue as non-clustered. Then have the "master node" put the connection factory to its own local queue on HA-JNDI and have other nodes look it up form there and send it directly to the lcoal queue of the master node (rather than using a clustered connection factory, etc)

      2- Create a topic rather than a queue. This way, every node gets those messages. Then I'll make it such that a node ignores those messages unless it is the master node. But this means a lot of waste.

      3- Create a queue programatically only on the master node and publish it on HA-JNDI. But then how can the master node subscribe to that programaticaly created queue ?


      I'd appreciate any help on this. Sorry if my question is dumb. I'm new to JMS.

      Thanks