I am using MDB for message processing, inside which i have some condition, if condition is false then i don't want to read the message, i.e. i don't want to lose the message.
Can any one tell me how to prevent MDB to read the message.
Aalok Singh wrote:Can any one tell me how to prevent MDB to read the message.
Aalok
My understanding is that you cannot stop an instance of a MDB from receiving a message once a queue/topic selects that instance to receive the message.
If you don't want to process the message at the time it is received by an instance of the MDB then you can set a property within the message header that indicates the message processing should be delayed and place the message back into the queue/topic or into another queue/topic so that it can be processed later. Below is an example of setting this message property on JBoss. Note that the property name "JMS_JBOSS_SCHEDULED_DELIVERY" is specific to JBoss, thus it will be different on another server.
Ravi Kiran Va wrote:I currently dont remember exactly how to do this , but as per my knowledge you need to google on
"Configuring MDB Message Selectors"
and for this to work you need to set Header properties to your Message also .
Google it you will find it .
before sending a message to a queue or topic add a property to it which would uniquely identify it like
and when configuring the listener or the mdb to listen to a queue and pickup only messages which have type "XYZ"
String messageSelector = "type = 'XYZ'"
TopicSubscriber sub = session.createSubscriber(topicName,messageSelector,true);
there are numerous operators other than '=', you can even do a wildcard match for the messageSelector like "'type LIKE 'XYZ%'"
this is with reference to ActiveMQ. the creation of subscriber might vary depending upon the third party provider.
Post by:autobot
I am displeased. You are no longer allowed to read this tiny ad:
a bit of art, as a gift, that will fit in a stocking