You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by MikeBAH <ba...@bah.com> on 2010/01/13 22:36:05 UTC

Camel and JMS Client Ack Mode?

I am trying out Camel for use in a project. 

One of the things we would like to do is have guaranteed delivery. To that
end I am trying to use Client Ack mode in JMS to leave a message on the
Queue I read it from until all the processing has been completed. 

This is similar to what was asked in this Thread:
http://old.nabble.com/guaranteed-message-processing-question...-td26202573.html
Thread on guaranteed-message-processing-question 

I have added the JmsComponent to the CamelContext using the
jmsComponentClientAcknowledge method as follows:

JmsComponent jc = JmsComponent.jmsComponentClientAcknowledge(cf);
context.addComponent("test-jms", jc);

but the message is always pulled off the JMS queue without a JMS Message
acknowledge() method call. 

	public class ProcessMessageOK implements Processor{
		@Override
		public void process(Exchange exchange) throws Exception {
			Message m = exchange.getIn();			
			log.info("Received message (body): " + m.getBody());
                        // ((JmsMessage)m).getJmsMessage().acknowledge();
		}
	}

This does not seem to work the way JMS 1.1 spec specifies (section 4.4.11
and 4.10) regarding CLIENT_ACKNOWLEDGEMENT. 

If I need to use transactions in Camel per the other thread, what does the
jmsComponentClientAcknowledge method actually do?

Thanks and sorry if I am missing something as I am new to Camel. 
Mike

-- 
View this message in context: http://old.nabble.com/Camel-and-JMS-Client-Ack-Mode--tp27152146p27152146.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel and JMS Client Ack Mode?

Posted by MikeBAH <ba...@bah.com>.
Been playing around and did find that when using the
jmsComponentClientAcknowledge method and the process method throws an
Exception that the JMS Message is indeed left on the JMS Queue.

In the case where jmsComponentAutoAcknowledge is used the JMS Message is
removed from the JMS Queue even with an Exception being thrown. 

Here is the sample Processor I used:

	public class ProcessMessageForceError implements Processor{
		@Override
		public void process(Exchange exchange) throws Exception {
			Message m = exchange.getIn();
			log.info("Testing Error: (body): " + m.getBody());
			throw new Exception("Forcing Error to see what happens");
		}
	}

So is there no way in Camel to leave the JMS Message on the JMS Queue unless
the JMS Message acknowledge method called or do we need to force an
Exception to get this behavior. 

Thanks,
Mike

-- 
View this message in context: http://old.nabble.com/Camel-and-JMS-Client-Ack-Mode--tp27152146p27163731.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel and JMS Client Ack Mode?

Posted by MikeBAH <ba...@bah.com>.
Just an FYI I am using Camel 2.1 
Thanks
-- 
View this message in context: http://old.nabble.com/Camel-and-JMS-Client-Ack-Mode--tp27152146p27153467.html
Sent from the Camel - Users mailing list archive at Nabble.com.