This discussion is archived
1 Reply Latest reply: Aug 29, 2012 2:17 AM by ramp RSS

How to make MDB with CLIENT_ACKNOWLEDGE

958150 Newbie
Currently Being Moderated
It seems like MDB doesn't support CLIENT_ACKNOWLEDGE mode. It supports only DUPS_OK_ACKNOWLEDGE and AUTO_ACKNOWLEDGE modes.

Basically, I need to be able to leave a message in queue if something bad happenes or my business logic fails inside method onMessage() of my MDB. In short, I want container to redeliver that message to my mdb. So how can I achieve this?

Regards,
Nitin
  • 1. Re: How to make MDB with CLIENT_ACKNOWLEDGE
    ramp Explorer
    Currently Being Moderated
    user13394165 wrote:
    It seems like MDB doesn't support CLIENT_ACKNOWLEDGE mode. It supports only DUPS_OK_ACKNOWLEDGE and AUTO_ACKNOWLEDGE modes.

    Basically, I need to be able to leave a message in queue if something bad happenes or my business logic fails inside method onMessage() of my MDB. In short, I want container to redeliver that message to my mdb. So how can I achieve this?

    Regards,
    Nitin
    Use Container Managed Transactions, set the transaction attribute to required and call setRollbackOnly() on the MessageDrivenContext object.
    Container Managed Transactions are handled by the container and the container would start a transaction when the message is picked up for delivery and commits only when the onMessage() successfully returns. An exception (or a rollback) would rollback everything including message delivery.

    Be careful to set up strategies to expire messages. Also any DB (from an SLSB perhaps) calls from the MDB has to use XA drivers.

    ram.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points