What is the preferred way to do a "Destination Bridge" featuring Message selectors in Websphere MQ?

StackOverflow https://stackoverflow.com/questions/23252999

  •  08-07-2023
  •  | 
  •  

Question

In TIBCO EMS, which I am familiar with, there is a feature called "destination bridges".

Queues and Topic can be bridged (linked) so that the 2nd destination can become client of the the first. (Queue to queue, Topic to queue, Queue to topic, topic to topic) For instance, a topic can be bridged to a queue, which in essence will become a durable subscriber of the messages submitted to the topic. Clients can subscribe to the topic OR read from the queue. This example is a way to load balance the reading of a pub/sub for multiple clients (readers of the queue). This "bridge" feature can also involve message selectors and destination name wilcards.

So, a QUEUE X can be the client of TOPIC.* with condition CUST_ID(a JMS attribute)>30. In that case, all message submitted to TOPIC.A OR TOPIC.B fitting the criteria would end up in QUEUE X. All this does not involve anything but simple EMS configuration.

I don't know enough about Websphere MQ, and I need a similar behavior. Will I have to develop a processing program outside of MQ, or can the feature within the product sufice ?

Note : I have already gone through MQ documentation and found about the "Alias queues" feature. Since the feature should really be called "Shortcut queue" and does not involve 2 destinations... I don't think it could help me...

Thanks!

Edit : For reference, the command (DEF SUB) enabling this in MQ is documented here

Edit 2 : The selected answer cover the "Topic -> Queue" pattern from TIBCO EMS "Destination bridge" featuire. Please note that the "Q->Q", T->T and Q->T" patterns are not covered here.

Was it helpful?

Solution

Easy! Define your queue to receive the subscription and then define a durable administrative subscription.

DEF QL(MY.SUSCRIBER.QUEUE)
DEF SUB('MY.SUBSCRIPTION') +
    TOPICSTR('SOME/TOPIC/#') +
    DEST('MY.SUSCRIBER.QUEUE') +
    SELECTOR('JMSType = 'car' AND color = 'blue' AND weight > 2500') +
    REPLACE

The Infocenter has a section on Selector Syntax and a page for the DEFINE SUB command.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top