users@glassfish.java.net

Re: MDB: Keep message order on redelivery

From: <glassfish_at_javadesktop.org>
Date: Tue, 04 Aug 2009 05:53:43 PDT

Hi Linda,

thanks for the swift reply.

> 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).

I just mean an exception thrown in the MDB, not an Application Server crash.

> 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.

That is good to know.

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

I would expect that the Glassfish container returns the message back to OpenMQ using a rollback instead of a commit. (In the Application Server crash case the commit is missing which also results in a re-delivery of the message).

My hope was that there is at least a specific OpenMQ configuration which forces sequential delivery since I am not sure whether this is mandated by the JMS spec.

> 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).

We do not want to have Java processes outside Glassfish. Or is this container also usable inside the server JVM?

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

I was expecting the Glassfish MDB container exactly working this way.

Cheers, Jörg

> -- 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=3585
> 96
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail:
> users-help_at_glassfish.dev.java.net
> >
> >
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail:
> users-help_at_glassfish.dev.java.net
[Message sent by forum member 'jthoennes' (jthoennes)]

http://forums.java.net/jive/thread.jspa?messageID=358764