[jboss-user] [JBoss Messaging] - Message selector and consuming messages

eontech do-not-reply at jboss.com
Tue Apr 14 01:08:41 EDT 2009

Hello Everyone,

We have a requirement of two queues. One primary and other secondary i.e. if a message can be processed immediately, it is sent to primary queue else it is sent to secondary queue. Both queues are consumed by different MDBs and all transactions work in container transaction.

For primary queue consumer MDB say P_mdb the processing is straight forward as the messages are consumed right away. But for secondary queue consumer MDB say S_mdb we need to limit the processing on the basis of flag. Thus as message selector we use a flag with value Y for this S_mdb. Thus messages with flag having value Y will be processed. Now when we want to send message to secondary queue we send message with flag as N. Thus message is sent to queue but not processed. But when we want to process this message, we browse through secondary queue and set the flag as Y to the message read from the queue, thus making it eligible for processing by S_mdb.

We want to know whether this approach is correct or there is other way to explicitly process subset of messages already present on queue i.e. selective processing. We do not want that message sent to queue to be processed right away but we want that we can have a control on which all messages can be processed i.e. consumed at later point of time. The method receive, receive (time), and receiveNoWait does not work for us as they do not give assurance that the message will be processed within the time limit of ongoing container transaction. That???s why we introduced S_mdb.

Though this approach works but we see that messages are processed only on high load for secondary queue by S_mdb otherwise the messages remain on the queue despite of changing their flag and not sent to S_mdb for consumption (waited for couple of hours!). That???s why I have raised the above question.

Best Regards,

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225231#4225231

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225231

More information about the jboss-user mailing list