Search code examples
jmsload-balancingtibcotibco-emsjms-topic

Load balancing Tibco EMS topic subscribers


I have a Tibco EMS topic subscriber which I need to load balance among different instances. Each published message to the topic needs to be received by one (and only one) instance of each subscriber load balance group.

Just using global topics and balanced EMS connections (tcp://localhost:7222|tcp://localhost:7224) results in the same message received by all instances of each subscriber load balance group, producing duplicates.

Do you know any alternative for load balancing topic subscribers?


Solution

  • You can:

    A) Bridge the topic to a queue and reconfigure your subscribers to read from the queue. Queues behave differently to topics in that a message is only obtained by one subscriber rather than all.

    B) Create a number of durable subscribers on the topic with selectors that divide messages between the durables. E.g. If a message has a property 'id' that is sequentially increasing:

    create durable topic DURABLENAME1 selector="(id - 2 * (id / 2)) = 0"
    create durable topic DURABLENAME2 selector="(id - 2 * (id / 2)) = 1"
    

    The selector is just a modulo so half the messages will go on one durable, and half on the other.