3 Replies Latest reply on Nov 12, 2004 12:00 AM by pra

    acknowledgement in MDB

    brijesh

      Hi all,
      Does anybody knows when a message is exactly acknowledged in case of MDB.
      Is there any way to send the acknowledgement only on successfull completion of onMessage().
      If there is any exception (or some condition is not satisfied)in code written in onMessage() the acknowledgement should not be send .
      Can anybody suggest me a way to do this .

      Regards,
      Brijesh

        • 1. Re: acknowledgement in MDB

          Hi, have you read the JBoss documentation (chapter 7) and the EJB 2.0 spec?

          Use setRollbackOnly() with container managed TX, or throw an EJBException with container managed TX.

          //Peter

          • 2. Re: acknowledgement in MDB
            brijesh

            Hi,
            I am using container managed transaction as per stated in chapter 8.
            My ejb-jar.xml is as follows
            ***********
            <?xml version="1.0"?>
            <!DOCTYPE ejb-jar>
            <ejb-jar>
            <enterprise-beans>
            <message-driven>
            <ejb-name>MDB1</ejb-name>
            <ejb-class>MDB1</ejb-class>
            <message-selector/>
            <transaction-type>Container</transaction-type>
            <message-driven-destination>
            <destination-type>javax.jms.Queue</destination-type>
            </message-driven-destination>
            </message-driven>
            </enterprise-beans>
            <assembly-descriptor>
            <container-transaction>

            <ejb-name>MDB1</ejb-name>
            <method-name>*</method-name>

            <trans-attribute>Required</trans-attribute>
            </container-transaction>
            </assembly-descriptor>
            </ejb-jar>
            **************

            BUT still the exception is thrown when i use getRollBackOnly() as follows
            **********
            MessageDriven bean is not allowed to call getRollbackOnly with this trans
            action settings
            ***********

            Does I need to do any other settings too?
            hope someone will help me out.

            Regards,
            Brijesh

            • 3. Re: acknowledgement in MDB

              Hi,
              I am using container managed transaction as per stated in chapter 8.
              My ejb-jar.xml is as follows
              ***********
              <?xml version="1.0"?>
              <!DOCTYPE ejb-jar>
              <ejb-jar>
              <enterprise-beans>
              <message-driven>
              <ejb-name>MDB1</ejb-name>
              <ejb-class>MDB1</ejb-class>
              <message-selector/>
              <transaction-type>Container</transaction-type>
              <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
              </message-driven-destination>
              </message-driven>
              </enterprise-beans>
              <assembly-descriptor>
              <container-transaction>

              <ejb-name>MDB1</ejb-name>
              <method-name>*</method-name>

              <trans-attribute>Required</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              </ejb-jar>
              **************

              BUT still the exception is thrown when i use getRollBackOnly() as follows
              **********
              MessageDriven bean is not allowed to call getRollbackOnly with this trans
              action settings
              ***********

              Does I need to do any other settings too?
              hope someone will help me out.

              Regards,
              Brijesh