Hi,

I think the problem actually come from the MEP (message exchange pattern) of your MessageChange is InOnly, so the Error message can't go back to JmsConsumer endpoint, which means the JmsConsumer endpoint have no chance to do the rollback.


Freeman

On 2010-1-17, at 上午5:24, Raphaël Delaporte wrote:

Hi,

I'm using SMX 3.3.1 with the JMS component 2009.01.

I use the jms-consumer endpoint in the XA transacted mode.
This works, because if I want to test the transactionnal behaviour, I
specify some wrong service endpoint and my JMS message is rolledback to the
queue. So that's OK.

But my route calls the Camel JBI endpoint within the transaction.
If I throw any exception from a camel bean, the transaction is not
rolledback, and the JMS message is not redelivered into the queue.
It seems the transaction is commited.

Here is my configuration :

--- JMS SMX component -----
<jms:consumer service="esb:jmsConsumerTrans" endpoint="jmsConsumer"
       targetService="esb:CamelTrans" targetEndpoint="trans"
destinationName="queue/in" connectionFactory="#connectionFactory"
       transacted="xa" />


--- Camel route -----
public void configure() throws Exception {

       errorHandler(noErrorHandler());

       from("jbi:endpoint:http://esb/CamelTrans/trans";)
       .to(LOG)
       .beanRef("routes", "erreur");

   }

   public void erreur() throws Exception {
       Thread.sleep(1000);
       throw new Exception("erreur ...");
   }



There is something strange to me (and this is why I guess this is a SMX related and not Camel related). I've enabled the debug mode, and I can see the content of the messages. In the last exchange, I can see an error field with my exception (the one which comes from the Camel endpoint I guess)

WARN  - SimpleEndpoint                 - SimpleEndpoint.fail called:
DEBUG - DeliveryChannelImpl            - Send
ID:192.168.0.3-12638f8f9d2-11:0 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow                       - Called Flow send
DEBUG - SedaQueue                      -
org.apache.servicemix.jbi.nmr.flow.seda.sedaqueu...@517bc3 dequeued
exchange: InOnly[
 id: ID:192.168.0.3-12638f8f9d2-11:0
 status: Error
 role: consumer
 service: {http://esb}CamelTrans
 endpoint: trans
in: <?xml version="1.0" encoding="UTF-8"?><requete xmlns="http:// esb"/>
 error: java.lang.Exception: erreur ...
]
DEBUG - DeliveryChannelImpl            - Notifying exchange
ID:192.168.0.3-12638f8f9d2-11:0(1b9bbe8) in DeliveryChannel{servicemix-jms}
from processInboundSynchronousExchange
DEBUG - DeliveryChannelImpl            - Notified:
ID:192.168.0.3-12638f8f9d2-11:0(1b9bbe8) in DeliveryChannel{servicemix-jms}
from sendSync


Thanks for your help !
Raphaël


--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com

Reply via email to