Results 1 to 10 of 10

Thread: How to set AcknowledgeMode in Spring?

  1. #1

    Default 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. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

  3. #3

    Default

    Thanks Denis.

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

    Thanks.
    Ganesh.

  4. #4
    Join Date
    Oct 2008
    Location
    Columbus, Ohio
    Posts
    10

    Default 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

  5. #5

    Default

    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.

  6. #6
    Join Date
    Oct 2008
    Location
    Columbus, Ohio
    Posts
    10

    Default 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

  7. #7

    Default

    Thanks Shishir.

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

    Ganesh.

  8. #8
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Quote 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?

  9. #9

    Default

    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.

  10. #10
    Join Date
    Oct 2008
    Location
    Columbus, Ohio
    Posts
    10

    Default 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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •