Search code examples
jakarta-eeejbjmsweblogicmessage-driven-bean

Weblogic/Message Driven Bean processing issue


Technologies:

Jave EE, Weblogic 10.3, JMS

Scenario:

An EJB module, say Module_1, with 3 distinct Message Driven Bean (MDB) classes monitoring 3 different Java Mssage Queues (JMS). Messages are constantly being added to these beans.

Problem:

Once every day, at a certain time, I need to restart the entire Weblogic Server without losing any message. Also, there is another module deployed on this server, say Module_2. And I need to make sure that Module_2 starts before Module_1.

If any message is being processed by any of the MDB at the predefined shutdown time, then I guess I will have to wait for it to finish. Not sure of it though.

Can someone suggest any standard approach/configuration to acheive that?

Also, what if the Weblogic Server is directly restarted without any sort of care? How will that affect the messages still in queue and those which were in the middle of processing?

Thanks.


Solution

  • The order in which modules are started is a config parameter: check out <deployment-order>10200</deployment-order> in config.xml. Lower numbered module gets deployed before higher-numbered module.

    As to the shutdown, you will want to do a "Graceful Shutdown" (http://docs.oracle.com/cd/E13222_01/wls/docs81/adminguide/overview_lifecycle.html#1045901). This should make the queue stop accepting new messages, make sure all messages are persisted, then wait for any in-flight messages to become processed. Only then will it stop.

    If you restart after a hard failure, the in-flight message will be re-processed because it was not completed properly. Usually, this is the expected behaviour.