users@glassfish.java.net

Re: MDB: Keep message order on redelivery

From: Linda Schneider <Linda.Schneider_at_Sun.COM>
Date: Mon, 03 Aug 2009 10:05:54 -0700

By "message fails", do you mean a processing error occurs and the
message could not be processed (and an exception is thrown out of the
MDB) or do you mean that the application server crashes (or similar).

OpenMQ should always deliver messages in order to the glassfish
container, it is then farmed out to multiple threads which deliver to
beans. This means t(if you only have one MDB) that messages should be
processed sequentially through a failure.

However, if you get an exception processing the message I believe the
MDB will simply deliver the next in line (vs redeliver the last).

If you need to guarantee ordering that goes beyond that, you will need
to use the JMS API outside of the MDB (e.g. in an appClient container).

To do that:
         Have the thread run in a loop calling receive(). The session
should be either transacted or client Acknowledge
         If you have an error processing call rollback (if transacted)
or recover (if not)

-- Linda

glassfish_at_javadesktop.org wrote:
> We have the business requirement that we process all messages in order.
> Therefore, only one Message Driven Bean is allowed to read from a queue at every point in time. We ensure this using a pool with exactly one instance.
>
> But what happens if the message processing fails and the message is redelivered? Are there any, even OpenMQ specific, means to redeliver this message as the first message from this queue in order to keep to message sequence?
>
> Thanks, Jörg
> [Message sent by forum member 'jthoennes' (jthoennes)]
>
> http://forums.java.net/jive/thread.jspa?messageID=358596
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>