• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question about clustering and jms

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have deployed a jee application to a JBoss 4.2 cluster. The application basically adds messages to a topic. mdbs(ejb 3.0) then subscribe to the topic and process the messages. I am using ha-jms( port 1100 ) on JBoss AS. Right now when it appears that the mdbs that I wrote are being called on both members of the cluster (currently there are only two members of the cluster). Is this the correct behavior for the mdbs? Should the all of the mdbs on all of the clusters receive the message from the cluster or should only the mdbs on one node of the cluster act on the message.

The desired behavior that we want is to only have one node's mdbs. Is this a misconfiguration problem or an architectural issue?

Thanks in Advance!
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not familiar with the JBoss environment, but I don't think the cluster has anything to do with how the topic works. When using a topic, any subscriber will receive the message, regardless of location. This is the case whether you're working with a cluster or with multiple subscribers in completely different environments.

I wonder if a queue is what you're looking for, though it won't help you if you want multiple MDBs in the same node to get the message. If that's what you need (many subscribers in a node, but only one node in the cluster should get a given message), then you might just want to have a topic for each node.
 
Burton Wynne
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeremiah Orr wrote:I'm not familiar with the JBoss environment, but I don't think the cluster has anything to do with how the topic works. When using a topic, any subscriber will receive the message, regardless of location. This is the case whether you're working with a cluster or with multiple subscribers in completely different environments.

I wonder if a queue is what you're looking for, though it won't help you if you want multiple MDBs in the same node to get the message. If that's what you need (many subscribers in a node, but only one node in the cluster should get a given message), then you might just want to have a topic for each node.



I guess I should be more specific. I have multiple mdbs deployed that subscribe to the topic (lets just say A,B,C). I want all of the different mdbs to be called but not the same mdb to be called across servers. When a new message is added to the topic I want A,B,C to be called. I just only want one instance of A,B and C to processed such that only A.x, B.y and C.z are called where x,y and z lie within the bounds of {1-n} and where n is the number of servers.

Thanks for the response...
 
Jeremiah Orr
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know of any "standard" way to accomplish what you're looking for by using a single topic. Perhaps JBoss provides some functionality that is appropriate for the clustered environment, but I'm not aware of anything like that.

An alternative approach: what about setting up a queue for each "type" of MDB? Using your example, you could set up a queue for A, a queue for B, and a queue for C. This would accomplish your end goal of having only one MDB of each "type" handle the message. Of course, it puts the burden on the message producer to know that it has to publish the message to 3 different queues. Not ideal.

A more complex approach that takes the burden off the message producer would be something like this:

- Set up queue "QD", which handles messages from the "source" producer.
- Create MDB "D", which will consume messages from QD. It can be clustered or not, doesn't matter.
- Create queues "QA", "QB", and "QC". When D receives consumes the "source" messages from QD, it will send them on to QA, QB, and QC.
- MDB A will subscribe to QA, B will subscribe to QB, and C will subscribe to QC.

Thus, when a message comes in to QD, MBD will send it on to QA, QB, and QC, and only a single instance each of MDBs A, B, and C will get a message. Not particularly clean, but it accomplishes your goal, I think.
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The MDB on each node would receive a copy of the message from a Topic in a clustered environment. If you dont want that to happen, you should reconsider your design.

ram.

Edit : You can deploy the mdb only on node in the cluster and have your fail over policy adjusted so that if the mdb on one node fails, it starts up on another. Google for ha-singleton or check out this link - http://onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html

ram.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic