Results 1 to 3 of 3

Thread: Load balancing/sharing topic listener within a cluster

  1. #1
    Join Date
    Feb 2012
    Posts
    8

    Default Load balancing/sharing topic listener within a cluster

    I'm using Spring JMS within tomcat container to publish/consume messages. There are different subsystems within one large application. Each of the subsystem runs under its own tomcat container

    I have a requirement where each of the subsystems running under different Webserver containers need to process a topic message concurrently. However within a subsystem there should be only one topic listener processing the topic message. In a single server instance this works fine as I configure just one MDB topic listener within a subsystem. However when the subsystem runs under a cluster each of the server instances within the cluster processes the topic message concurrently. How can I ensure only one instance within the cluster consumes the topic message.




    Thanks
    Chandru

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,037

    Default

    Some brokers (e.g. SonicMQ) allow you to configure the topic so only one consumer with a particular client id can connect. When the active component fails, the broker allows one of the others to connect. But this isn't standard in JMS; you'd have to look at your broker's documentation to see if that's possible.

    You can either distribute the work with Queues instead of Topics or use a management tool (via JMX) to start/stop the listener containers to ensure there's only one consumer of a particular type.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Feb 2012
    Posts
    8

    Default

    Thanks for the lead, it helped resolve the issue. This is working using Sonic's Group subscription

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •