Two MDB (with Diff. Msg Selector) looking one queue-problem


EJB programming & troubleshooting: Two MDB (with Diff. Msg Selector) looking one queue-problem

  1. Hello All,

    i have one promblem regarding implementing MDB with Queue,

    My module flow like this

    EAI send one Request messge to My queue, i have one MDB with msg selector is 'Verify' , pick up the message and process it and put it n same queue. after that EAI send one acknowledgement msg to same queue, i have one session bean , that bean waiting for the ack. msg and pick up the message and again process and put it n same queue with n 30 seconds. if i fail to put the message with n 30 seconds, EAI Send one cancelation msg to that queue.

    so my problem is

    how can i pick up the cancelation msg without using Session bean.?

    can i use one more MDB to Pick up the cancelation msg?
    can i use two MDB with Msg selector looking for one queue?

    or any other way to solve the prblm?

    thanx n advance
  2. Muruganandam -
    Try using the chain-of-responsibility pattern in your MDB so that the MDB can simply subscribe to the queue and make a determination of what needs to happen to the message. Basically, you would have a chain of handlers that know how to deal with the diffent message types. If you have multiple things that have to happen to the message try the visitor pattern.

    Using message-selectors is OK but you limit your functinality over time. Additionally, you run some performance risks if your app has a high-volume of messages (message-selectors can be quite slow).

    Just a thought -