0

I got a MDB which picks up all the messages dropped in a Queue owned by somebody else

There are many subscribers to that Queue.

I am interested only in a particular type of message. Like some messages start as "Password Changed". Others are like "Violation".

I don't want to Acknowledge the messages that i am not interested in and leave it in the Queue for somebody else who would be interested in it

How do I do it?

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
juniorbansal
  • 1,249
  • 8
  • 31
  • 51

3 Answers3

2

You can use a Selector to filter only required messages. Another approach is to set a specific header(s) to a message in order to filter/select it without touching an actual message.

Anton N
  • 2,317
  • 24
  • 28
  • Thank You. I referred here and it says i can't apply the filter based on the content of the message body. Can you please advise http://docs.oracle.com/cd/E19798-01/821-1841/bncer/index.html – juniorbansal Aug 11 '15 at 02:33
2

JMS specification says messages can be filtered based on message headers and properties. Accordingly IBM MQ JMS allows applications to select messages based on JMS message headers and user properties. Message can not be filtered based on contents of body.

You can ask the sender application to set message properties and your MDB can filter based on those properties.

The other option is to use a dedicated queue for your MDB in which case you don't need to filter messages.

Shashi
  • 14,980
  • 2
  • 33
  • 52
1

It seem your requirement is typically a publish/subscribe pattern where there is one or more producer and multiple subscribers. You will be one of the subscriber, get the message, test if the text you are looking for is in the payload and process it, discard it if not. If any case, just consume the message in YOUR Q (ie commit=delete message), the other subscribers will not be affected as thwy will have their own Q to subscribe to

titou10
  • 2,814
  • 1
  • 19
  • 42