Nov 13th, 2008, 08:19 AM
How to set AcknowledgeMode in Spring?
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
message.acknowledge() on the listener which is an MDP.
Nov 13th, 2008, 08:39 AM
Nov 13th, 2008, 10:11 AM
If I want the listener to acknowledge as soon as the message is received, how would I do that?
Nov 13th, 2008, 12:21 PM
did you try this?
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)
Nov 13th, 2008, 12:29 PM
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?
Nov 13th, 2008, 12:40 PM
try acknowledge as first step
You can try acknowledge as the first step in OnMessage or try the AUTO_ACKNOWLEDGE instead of CLIENT_ACKNOWLEDGE.
Nov 13th, 2008, 12:57 PM
I've tried both and neither works the way I want.
Nov 13th, 2008, 02:24 PM
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?
Originally Posted by gunacesun_spring
Nov 13th, 2008, 02:41 PM
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.
Nov 13th, 2008, 03:29 PM
Are you processing the Message in OnMessage()
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.
Tags for this Thread