1 Reply Latest reply: Aug 29, 2012 4:17 AM by ramp RSS

    How to make MDB with CLIENT_ACKNOWLEDGE

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