Announcement Announcement Module
Collapse
No announcement yet.
How to set AcknowledgeMode in Spring? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set AcknowledgeMode in Spring?

    Hi all,

    I want to do something similar to the following code using Spring. Could someone tell me how?

    Session sess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
    on the sender

    and also

    message.acknowledge() on the listener which is an MDP.

    Thanks.
    Ganesh.

  • #2
    setSessionAcknowledgeMode()
    setSessionAcknowledgeModeName()

    Comment


    • #3
      Thanks Denis.

      If I want the listener to acknowledge as soon as the message is received, how would I do that?

      Thanks.
      Ganesh.

      Comment


      • #4
        did you try this?

        Hi Ganesh,
        If you are using JMS template and DMLC then did you try setting this property
        <property name="sessionAcknowledgeModeName" alue="CLIENT_ACKNOWLEDGE"/>

        and in OnMessage(Message a_jmsMsg)

        a_jmsMsg.acknowledge();

        thanks
        Shishir

        Comment


        • #5
          Oh yeah, I tried mesage.acknowledge().

          But I want send the acknowledgment before processing the message. I do a lot of DB processing and I wanted to acknowledge the receipt of the message as soon as the message is received, even before processing it.

          Is there any way to do this?

          Thanks.
          Ganesh.

          Comment


          • #6
            try acknowledge as first step

            Hi Ganesh,
            You can try acknowledge as the first step in OnMessage or try the AUTO_ACKNOWLEDGE instead of CLIENT_ACKNOWLEDGE.

            Thanks
            shishir

            Comment


            • #7
              Thanks Shishir.

              I've tried both and neither works the way I want.

              Ganesh.

              Comment


              • #8
                Originally posted by gunacesun_spring View Post
                Thanks Shishir.

                I've tried both and neither works the way I want.

                Ganesh.
                So, you defined CLIENT_ACKNOWLEDGE mode and acknowledge the message as the first mdp statement. What means 'neither works the way I want'? What kind of problem are you experiencing?

                Comment


                • #9
                  By 'neither works the way I want', I mean, in either case the receiver seems to wait for the processing of the message to complete before sending the acknowledgment back.

                  In my case, when the acknowledgment is sent back after a time consuming process, I get a "Broken Pipe" exception.

                  Ganesh.

                  Comment


                  • #10
                    Are you processing the Message in OnMessage()

                    Hi Ganesh,
                    Are you processing the message after receiving in the OnMessage() itself . Or are are you spawning a thread to handle the message processing?
                    The way i have used it, is to keep OnMessage() as light as possible in terms of processing viz(add message to a queue or set and then process it in a separate thread) but acknowledge it as soon as you can.

                    Thanks
                    shishir

                    Comment

                    Working...
                    X