JMS/MDB architecture
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Boaz_Inbal
Posted On:   Sunday, May 5, 2002 03:53 AM

I intend to build 2 layers queuing mechanism. Layer 1 will consist of a major MDB that receives messages from all kind of different beans running on a websphere. This bean will need to route the messages to the second layer which consist of 1-n queues, for each worker class. The complexity is that the worker takes the message and tries to write it to a DB, in case he fails, I would like to disconnect the worker queue so he will no longer receive messages from the 1st layer MDB. On my 1st layer, I figured that I need to implements a SessionBean with onMessage method. In this way, I get 'closer' to real MDB    More>>

I intend to build 2 layers queuing mechanism. Layer 1 will consist of a


major MDB that receives messages from all kind of different beans running


on a websphere.


This bean will need to route the messages to the second layer which


consist of 1-n queues, for each worker class.


The complexity is that the worker takes the message and tries to write it


to a DB, in case he fails, I would like to disconnect the worker queue so he


will no longer receive messages from the 1st layer MDB.


On my 1st layer, I figured that I need to implements a SessionBean with


onMessage method. In this way, I get 'closer' to real MDB functionality in


means that the server controls the bean and the listener.


On the 2nd layer, Is there a way to tell a listener bean to stop getting


messages from the queue on run-time? If I cannot configure the bean to


listen/don't listen on run-time, I need another approach, probably to use


threads. What is the Websphere approach for using threads?


Thank you!

   <<Less

Re: JMS/MDB architecture

Posted By:   Martin_Kernland  
Posted On:   Monday, May 6, 2002 02:55 AM

Hi Boaz

I'm not sure I understood your architecture, but here a few comments:


  • Use CLIENT_ACK instead of AUTO_ACK. This way you can first write to the DB and if it
    succeeds then you can acknowledge the message. If it fails, then you dont acknowledge the
    messge and the JMS server will redistribute this message to another worker.


  • You might want to think about using receive() instead of onMessage() on the second layer.
    I'm not quite sure what you want to do, but you might find it useful. You only pick messages from the
    Queue when you want to.


  • On the first layer you said you would like to use a SessionBean as MessageListener. Well, I
    guess there is a reason why the spec introduced the MDB. I do not see any reason not to use an MDB.


  • If your beans know to what queue (on the 2nd layer) the messages need to be delivered, you
    could also use MessageSelectors in your Workers. This way the worker will pick the right message and
    you do not have to create a new queue for each worker class.



Hope this helps,

Martin
About | Sitemap | Contact