You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Raphaël Delaporte <ra...@gmail.com> on 2010/01/16 22:24:11 UTC

Transaction rollback with Camel JBI endpoint

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.SedaQueue$1@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

Re: Transaction rollback with Camel JBI endpoint

Posted by gnanda <gi...@phaseforward.com>.
Did your below scenario worked yet? I am trying to build a similar flow 
I am using smx4, but I am sure any insight will help 
i have flow like as below 
smx jms consumer->camel router-> http provider
I am trying to build XA transaction  which will be  will started from jms
consumer. I could not find any good document from servicemix documentation
site. It will be a great help if you can provide me some information of how
you implemented transaction here.
Thank you very much


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.SedaQueue$1@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
> 
> 

-- 
View this message in context: http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p28360258.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Transaction rollback with Camel JBI endpoint

Posted by tranchida <gi...@tranchida.ch>.
did you set autoEnlistInTransaction="true" in servicemix.xml ?

  <!-- the JBI container -->
  <sm:container id="jbi" 
                rootDir="./data/smx" 
                MBeanServer="#jmxServer"
                installationDirPath="./hotdeploy"
                                monitorDeploymentDirectory="false"
                monitorInterval="1"
                transactionManager="#transactionManager"
                autoEnlistInTransaction="true"
                createJmxConnector="false"
                depends-on="jndi">



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.SedaQueue$1@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
> 
> 

-- 
View this message in context: http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27195901.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Transaction rollback with Camel JBI endpoint

Posted by Willem Jiang <wi...@gmail.com>.
In servicemix-camel 2009.02, we upgrade the camel version from 1.6.x to 
2.x. Since there are some Camel API changed, you need to rebuild the 
RouteBuilder again.

Willem

Raphaël Delaporte wrote:
> I'd like to use the 2009.02 version ... but unfortunatly, the migration is
> not as easy it should be ...
> Just replacing the old jar by the new one does not work...
> Have to modify the camel descriptor, and my java routes are still not loaded
> by camel ..
> 
> 
> <stack-trace><![CDATA[org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'camelContext': Invocation of init method
> failed; nested exception is java.lang.NoSuchMethodError:
> com.esb.camel_su.routes.Routes.from(Ljava/lang/String;)Lorg/apache/camel/model/RouteType;
> 
> Raphaël
> 
> 
> 2010/1/17 tranchida <gi...@tranchida.ch>
> 
>> Probably the version 2009.02 fix this bug
>>
>> http://issues.apache.org/activemq/browse/SMXCOMP-651
>>
>>
>>
>>
>> Raphaël Delaporte wrote:
>>> I'm using the SMX 3.3.1 with 2009.01 version (JMS & Camel).
>>> I was thinking the same thing ... Looks like the JMS consumer never got
>>> the
>>> DONE;
>>>
>>> It does the same thing with the ?mep=in-only ...
>>>
>>>
>>> OK this works if I do 2 camel routes as you suggested ... Strange isn't
>> it
>>> ?
>>> Is it a bug ?
>>>
>>>
>>> Raphaël
>>>
>>>
>>> 2010/1/17 tranchida <gi...@tranchida.ch>
>>>
>>>> It's look like the jms consumer never receive a done status from camel
>>>>
>>>> I don't know maybe it's a bug in servicemix-camel, which version do you
>>>> use
>>>> ?
>>>>
>>>> You can try to add ?mep=in-only to force an in-only exchange
>>>>
>>>> jbi:endpoint:
>>>> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ?mep=in-out
>>>>
>>>> see
>>>>
>> http://camel.apache.org/how-do-i-set-the-mep-when-interacting-with-jbi.html
>>>> you can also maybe isolate your route with a camel seda
>>>>
>>>> from("jbi:...").to("seda:job");
>>>>
>>>> from("seda:job")....
>>>>
>>>>
>>>>
>>>> Raphaël Delaporte wrote:
>>>>> Hi
>>>>>
>>>>> Thanks for explaination.
>>>>> I've been running in other troubles... but this time, I run in a non
>>>>> transacted routes.
>>>>>
>>>>> I've a JMS consumer which calls a Camel JBI endpoint, and if
>> everything
>>>>> goes
>>>>> well, calls an other JMS provider to put the message in a queue (this
>>>>> works
>>>>> well).
>>>>> In this Camel endpoint, I want to define an errorHandler which sends
>>>> the
>>>>> message to a DLQ for example.
>>>>>>> errorHandler(deadLetterChannel("jbi:endpoint:
>>>>> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));
>>>>>
>>>>> On errors, my custom error handler is called and I am able to find my
>>>>> message in my DLQ (this works well)
>>>>> But, my JMS consumer doesn't want to take anymore messages. It seems
>>>> it's
>>>>> freezed on the last exchange (and servicemix is freezed as well,
>> cannot
>>>>> shutdown, etc..)
>>>>>
>>>>> When I keep the default error handler, or if I set something like
>> this,
>>>> it
>>>>> works.
>>>>>>> errorHandler(deadLetterChannel("log:myClass"));
>>>>> Seems I've got trouble when I want to call other JBI endpoints into
>> the
>>>>> errorHandler.
>>>>>
>>>>> Any ideas of what's happen ?
>>>>>
>>>>> Thanks for your help.
>>>>> Raphaël
>>>>>
>>>>>
>>>>> 2010/1/17 tranchida <gi...@tranchida.ch>
>>>>>
>>>>>> The explanation of autoEnlistInTransaction and the different QOS
>>>>>> depending
>>>>>> on
>>>>>> the flow can be found here ->
>>>>>> http://servicemix.apache.org/transactions.html
>>>>>>
>>>>>> For my usage, I totaly disable jms and jca flow. I use only seda and
>>>>>> pairs
>>>>>> of jms consumer/provider for persistence / failover / load balancing.
>>>>>>
>>>>>> See ref :
>>>>>>
>>>>>>
>>>>>>
>> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
>> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
>>>>>>
>>>>>>
>>>>>> Raphaël Delaporte wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Thanks for your replies.
>>>>>>>
>>>>>>> 1. I did not set the autoEnlistInTransaction="true" in
>>>> servicemix.xml,
>>>>>> but
>>>>>>> I
>>>>>>> don't understand for what this property is used for. I've just seen
>>>>>>> "Retrieve the value for automatic transaction enlistment" but it's
>>>> not
>>>>>>> very
>>>>>>> clear for me ...
>>>>>>>   -> OK it works with this property !! Very good !
>>>>>>>
>>>>>>>
>>>>>>> 2. Ok my MEP is InOnly because it comes from a jms consumer :
>>>>>>>  - but why have I the transaction rolledback if I specify
>>>> non-existant
>>>>>>> targetEndpoint / targetService for example ? Is it because the
>>>> exchange
>>>>>> is
>>>>>>> still on the jms component side ?
>>>>>>>  - How can I specify an InOut MEP on the jms consumer ?
>>>>>>>      - the defaultMep property does not exist anymore on the new
>> JMS
>>>>>>> endpoints
>>>>>>>      - the synchronous property does not change the MEP
>>>>>>>
>>>>>>>
>>>>>>> 3. Subsidiary question guys.
>>>>>>> I've seen in the stacktrace when transaction is rolledback that the
>>>>>> flow
>>>>>>> used is the SEDA flow. I guess this flow is not persistant at all
>> ..
>>>> Am
>>>>>> I
>>>>>>> wrong ?
>>>>>>> Is there a way to force this exchange to use other flow, as JMS
>> flow
>>>>>> for
>>>>>>> instance ?
>>>>>>> I commented out the SEDA flow in the servicemix.xml, and it uses
>> the
>>>>>> JMS
>>>>>>> flow. But this is not really a good method...
>>>>>>>
>>>>>>>
>>>>>>> Thanks a lot !
>>>>>>> Raphaël
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
>>>>>>>
>>>>>>>> Hi Raph,
>>>>>>>>
>>>>>>>> be careful, as your MEP is InOnly, in case of error, it can't go
>>>> back
>>>>>> to
>>>>>>>> the JMS endpoint.
>>>>>>>>
>>>>>>>> Try to use InOut MEP, it should be better.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>>
>>>>>>>> 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.SedaQueue$1@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
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> ---------------------------------
>>>>>>>>  HomePage
>>>>>>>> http://www.nanthrax.net
>>>>>>>> ---------------------------------
>>>>>>>>  Contacts
>>>>>>>> jbonofre@apache.org
>>>>>>>> jb@nanthrax.net
>>>>>>>> ---------------------------------
>>>>>>>>  OpenSource
>>>>>>>> BuildProcess/AutoDeploy
>>>>>>>> http://buildprocess.sourceforge.net
>>>>>>>> Apache ServiceMix
>>>>>>>> http://servicemix.apache.org
>>>>>>>> -----------------------------------
>>>>>>>> PGP : 17D4F086
>>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
>>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>>
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200582.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>> --
>> View this message in context:
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200896.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 


Re: Transaction rollback with Camel JBI endpoint

Posted by Raphaël Delaporte <ra...@gmail.com>.
Ok guys, sorry...
This was a build class issue fom my f***ing eclipse.

I've updated the jms and the camel to 2009.02 version, and it works much
better.
Thanks all.

Raphaël


Le 17 janvier 2010 19:07, Raphaël Delaporte <ra...@gmail.com> a
écrit :

> I'd like to use the 2009.02 version ... but unfortunatly, the migration is
> not as easy it should be ...
> Just replacing the old jar by the new one does not work...
> Have to modify the camel descriptor, and my java routes are still not
> loaded by camel ..
>
>
> <stack-trace><![CDATA[org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'camelContext': Invocation of init method
> failed; nested exception is java.lang.NoSuchMethodError:
> com.esb.camel_su.routes.Routes.from(Ljava/lang/String;)Lorg/apache/camel/model/RouteType;
>
>
> Raphaël
>
>
> 2010/1/17 tranchida <gi...@tranchida.ch>
>
>>
>> Probably the version 2009.02 fix this bug
>>
>> http://issues.apache.org/activemq/browse/SMXCOMP-651
>>
>>
>>
>>
>> Raphaël Delaporte wrote:
>> >
>> > I'm using the SMX 3.3.1 with 2009.01 version (JMS & Camel).
>> > I was thinking the same thing ... Looks like the JMS consumer never got
>> > the
>> > DONE;
>> >
>> > It does the same thing with the ?mep=in-only ...
>> >
>> >
>> > OK this works if I do 2 camel routes as you suggested ... Strange isn't
>> it
>> > ?
>> > Is it a bug ?
>> >
>> >
>> > Raphaël
>> >
>> >
>> > 2010/1/17 tranchida <gi...@tranchida.ch>
>> >
>> >>
>> >> It's look like the jms consumer never receive a done status from camel
>> >>
>> >> I don't know maybe it's a bug in servicemix-camel, which version do you
>> >> use
>> >> ?
>> >>
>> >> You can try to add ?mep=in-only to force an in-only exchange
>> >>
>> >> jbi:endpoint:
>> >> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ?mep=in-out
>> >>
>> >> see
>> >>
>> http://camel.apache.org/how-do-i-set-the-mep-when-interacting-with-jbi.html
>> >>
>> >> you can also maybe isolate your route with a camel seda
>> >>
>> >> from("jbi:...").to("seda:job");
>> >>
>> >> from("seda:job")....
>> >>
>> >>
>> >>
>> >> Raphaël Delaporte wrote:
>> >> >
>> >> > Hi
>> >> >
>> >> > Thanks for explaination.
>> >> > I've been running in other troubles... but this time, I run in a non
>> >> > transacted routes.
>> >> >
>> >> > I've a JMS consumer which calls a Camel JBI endpoint, and if
>> everything
>> >> > goes
>> >> > well, calls an other JMS provider to put the message in a queue (this
>> >> > works
>> >> > well).
>> >> > In this Camel endpoint, I want to define an errorHandler which sends
>> >> the
>> >> > message to a DLQ for example.
>> >> >>> errorHandler(deadLetterChannel("jbi:endpoint:
>> >> > http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));
>> >> >
>> >> > On errors, my custom error handler is called and I am able to find my
>> >> > message in my DLQ (this works well)
>> >> > But, my JMS consumer doesn't want to take anymore messages. It seems
>> >> it's
>> >> > freezed on the last exchange (and servicemix is freezed as well,
>> cannot
>> >> > shutdown, etc..)
>> >> >
>> >> > When I keep the default error handler, or if I set something like
>> this,
>> >> it
>> >> > works.
>> >> >>> errorHandler(deadLetterChannel("log:myClass"));
>> >> >
>> >> > Seems I've got trouble when I want to call other JBI endpoints into
>> the
>> >> > errorHandler.
>> >> >
>> >> > Any ideas of what's happen ?
>> >> >
>> >> > Thanks for your help.
>> >> > Raphaël
>> >> >
>> >> >
>> >> > 2010/1/17 tranchida <gi...@tranchida.ch>
>> >> >
>> >> >>
>> >> >> The explanation of autoEnlistInTransaction and the different QOS
>> >> >> depending
>> >> >> on
>> >> >> the flow can be found here ->
>> >> >> http://servicemix.apache.org/transactions.html
>> >> >>
>> >> >> For my usage, I totaly disable jms and jca flow. I use only seda and
>> >> >> pairs
>> >> >> of jms consumer/provider for persistence / failover / load
>> balancing.
>> >> >>
>> >> >> See ref :
>> >> >>
>> >> >>
>> >> >>
>> >>
>> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
>> >> >>
>> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
>> >> >>
>> >> >>
>> >> >>
>> >> >> Raphaël Delaporte wrote:
>> >> >> >
>> >> >> > Hi,
>> >> >> >
>> >> >> > Thanks for your replies.
>> >> >> >
>> >> >> > 1. I did not set the autoEnlistInTransaction="true" in
>> >> servicemix.xml,
>> >> >> but
>> >> >> > I
>> >> >> > don't understand for what this property is used for. I've just
>> seen
>> >> >> > "Retrieve the value for automatic transaction enlistment" but it's
>> >> not
>> >> >> > very
>> >> >> > clear for me ...
>> >> >> >   -> OK it works with this property !! Very good !
>> >> >> >
>> >> >> >
>> >> >> > 2. Ok my MEP is InOnly because it comes from a jms consumer :
>> >> >> >  - but why have I the transaction rolledback if I specify
>> >> non-existant
>> >> >> > targetEndpoint / targetService for example ? Is it because the
>> >> exchange
>> >> >> is
>> >> >> > still on the jms component side ?
>> >> >> >  - How can I specify an InOut MEP on the jms consumer ?
>> >> >> >      - the defaultMep property does not exist anymore on the new
>> JMS
>> >> >> > endpoints
>> >> >> >      - the synchronous property does not change the MEP
>> >> >> >
>> >> >> >
>> >> >> > 3. Subsidiary question guys.
>> >> >> > I've seen in the stacktrace when transaction is rolledback that
>> the
>> >> >> flow
>> >> >> > used is the SEDA flow. I guess this flow is not persistant at all
>> ..
>> >> Am
>> >> >> I
>> >> >> > wrong ?
>> >> >> > Is there a way to force this exchange to use other flow, as JMS
>> flow
>> >> >> for
>> >> >> > instance ?
>> >> >> > I commented out the SEDA flow in the servicemix.xml, and it uses
>> the
>> >> >> JMS
>> >> >> > flow. But this is not really a good method...
>> >> >> >
>> >> >> >
>> >> >> > Thanks a lot !
>> >> >> > Raphaël
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
>> >> >> >
>> >> >> >> Hi Raph,
>> >> >> >>
>> >> >> >> be careful, as your MEP is InOnly, in case of error, it can't go
>> >> back
>> >> >> to
>> >> >> >> the JMS endpoint.
>> >> >> >>
>> >> >> >> Try to use InOut MEP, it should be better.
>> >> >> >>
>> >> >> >> Regards
>> >> >> >> JB
>> >> >> >>
>> >> >> >>
>> >> >> >> 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.SedaQueue$1@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
>> >> >> >>>
>> >> >> >>>
>> >> >> >> --
>> >> >> >> Jean-Baptiste Onofré
>> >> >> >> ---------------------------------
>> >> >> >>  HomePage
>> >> >> >> http://www.nanthrax.net
>> >> >> >> ---------------------------------
>> >> >> >>  Contacts
>> >> >> >> jbonofre@apache.org
>> >> >> >> jb@nanthrax.net
>> >> >> >> ---------------------------------
>> >> >> >>  OpenSource
>> >> >> >> BuildProcess/AutoDeploy
>> >> >> >> http://buildprocess.sourceforge.net
>> >> >> >> Apache ServiceMix
>> >> >> >> http://servicemix.apache.org
>> >> >> >> -----------------------------------
>> >> >> >> PGP : 17D4F086
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200582.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200896.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>

Re: Transaction rollback with Camel JBI endpoint

Posted by Raphaël Delaporte <ra...@gmail.com>.
I'd like to use the 2009.02 version ... but unfortunatly, the migration is
not as easy it should be ...
Just replacing the old jar by the new one does not work...
Have to modify the camel descriptor, and my java routes are still not loaded
by camel ..


<stack-trace><![CDATA[org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'camelContext': Invocation of init method
failed; nested exception is java.lang.NoSuchMethodError:
com.esb.camel_su.routes.Routes.from(Ljava/lang/String;)Lorg/apache/camel/model/RouteType;

Raphaël


2010/1/17 tranchida <gi...@tranchida.ch>

>
> Probably the version 2009.02 fix this bug
>
> http://issues.apache.org/activemq/browse/SMXCOMP-651
>
>
>
>
> Raphaël Delaporte wrote:
> >
> > I'm using the SMX 3.3.1 with 2009.01 version (JMS & Camel).
> > I was thinking the same thing ... Looks like the JMS consumer never got
> > the
> > DONE;
> >
> > It does the same thing with the ?mep=in-only ...
> >
> >
> > OK this works if I do 2 camel routes as you suggested ... Strange isn't
> it
> > ?
> > Is it a bug ?
> >
> >
> > Raphaël
> >
> >
> > 2010/1/17 tranchida <gi...@tranchida.ch>
> >
> >>
> >> It's look like the jms consumer never receive a done status from camel
> >>
> >> I don't know maybe it's a bug in servicemix-camel, which version do you
> >> use
> >> ?
> >>
> >> You can try to add ?mep=in-only to force an in-only exchange
> >>
> >> jbi:endpoint:
> >> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ?mep=in-out
> >>
> >> see
> >>
> http://camel.apache.org/how-do-i-set-the-mep-when-interacting-with-jbi.html
> >>
> >> you can also maybe isolate your route with a camel seda
> >>
> >> from("jbi:...").to("seda:job");
> >>
> >> from("seda:job")....
> >>
> >>
> >>
> >> Raphaël Delaporte wrote:
> >> >
> >> > Hi
> >> >
> >> > Thanks for explaination.
> >> > I've been running in other troubles... but this time, I run in a non
> >> > transacted routes.
> >> >
> >> > I've a JMS consumer which calls a Camel JBI endpoint, and if
> everything
> >> > goes
> >> > well, calls an other JMS provider to put the message in a queue (this
> >> > works
> >> > well).
> >> > In this Camel endpoint, I want to define an errorHandler which sends
> >> the
> >> > message to a DLQ for example.
> >> >>> errorHandler(deadLetterChannel("jbi:endpoint:
> >> > http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));
> >> >
> >> > On errors, my custom error handler is called and I am able to find my
> >> > message in my DLQ (this works well)
> >> > But, my JMS consumer doesn't want to take anymore messages. It seems
> >> it's
> >> > freezed on the last exchange (and servicemix is freezed as well,
> cannot
> >> > shutdown, etc..)
> >> >
> >> > When I keep the default error handler, or if I set something like
> this,
> >> it
> >> > works.
> >> >>> errorHandler(deadLetterChannel("log:myClass"));
> >> >
> >> > Seems I've got trouble when I want to call other JBI endpoints into
> the
> >> > errorHandler.
> >> >
> >> > Any ideas of what's happen ?
> >> >
> >> > Thanks for your help.
> >> > Raphaël
> >> >
> >> >
> >> > 2010/1/17 tranchida <gi...@tranchida.ch>
> >> >
> >> >>
> >> >> The explanation of autoEnlistInTransaction and the different QOS
> >> >> depending
> >> >> on
> >> >> the flow can be found here ->
> >> >> http://servicemix.apache.org/transactions.html
> >> >>
> >> >> For my usage, I totaly disable jms and jca flow. I use only seda and
> >> >> pairs
> >> >> of jms consumer/provider for persistence / failover / load balancing.
> >> >>
> >> >> See ref :
> >> >>
> >> >>
> >> >>
> >>
> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
> >> >>
> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
> >> >>
> >> >>
> >> >>
> >> >> Raphaël Delaporte wrote:
> >> >> >
> >> >> > Hi,
> >> >> >
> >> >> > Thanks for your replies.
> >> >> >
> >> >> > 1. I did not set the autoEnlistInTransaction="true" in
> >> servicemix.xml,
> >> >> but
> >> >> > I
> >> >> > don't understand for what this property is used for. I've just seen
> >> >> > "Retrieve the value for automatic transaction enlistment" but it's
> >> not
> >> >> > very
> >> >> > clear for me ...
> >> >> >   -> OK it works with this property !! Very good !
> >> >> >
> >> >> >
> >> >> > 2. Ok my MEP is InOnly because it comes from a jms consumer :
> >> >> >  - but why have I the transaction rolledback if I specify
> >> non-existant
> >> >> > targetEndpoint / targetService for example ? Is it because the
> >> exchange
> >> >> is
> >> >> > still on the jms component side ?
> >> >> >  - How can I specify an InOut MEP on the jms consumer ?
> >> >> >      - the defaultMep property does not exist anymore on the new
> JMS
> >> >> > endpoints
> >> >> >      - the synchronous property does not change the MEP
> >> >> >
> >> >> >
> >> >> > 3. Subsidiary question guys.
> >> >> > I've seen in the stacktrace when transaction is rolledback that the
> >> >> flow
> >> >> > used is the SEDA flow. I guess this flow is not persistant at all
> ..
> >> Am
> >> >> I
> >> >> > wrong ?
> >> >> > Is there a way to force this exchange to use other flow, as JMS
> flow
> >> >> for
> >> >> > instance ?
> >> >> > I commented out the SEDA flow in the servicemix.xml, and it uses
> the
> >> >> JMS
> >> >> > flow. But this is not really a good method...
> >> >> >
> >> >> >
> >> >> > Thanks a lot !
> >> >> > Raphaël
> >> >> >
> >> >> >
> >> >> >
> >> >> > 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
> >> >> >
> >> >> >> Hi Raph,
> >> >> >>
> >> >> >> be careful, as your MEP is InOnly, in case of error, it can't go
> >> back
> >> >> to
> >> >> >> the JMS endpoint.
> >> >> >>
> >> >> >> Try to use InOut MEP, it should be better.
> >> >> >>
> >> >> >> Regards
> >> >> >> JB
> >> >> >>
> >> >> >>
> >> >> >> 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.SedaQueue$1@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
> >> >> >>>
> >> >> >>>
> >> >> >> --
> >> >> >> Jean-Baptiste Onofré
> >> >> >> ---------------------------------
> >> >> >>  HomePage
> >> >> >> http://www.nanthrax.net
> >> >> >> ---------------------------------
> >> >> >>  Contacts
> >> >> >> jbonofre@apache.org
> >> >> >> jb@nanthrax.net
> >> >> >> ---------------------------------
> >> >> >>  OpenSource
> >> >> >> BuildProcess/AutoDeploy
> >> >> >> http://buildprocess.sourceforge.net
> >> >> >> Apache ServiceMix
> >> >> >> http://servicemix.apache.org
> >> >> >> -----------------------------------
> >> >> >> PGP : 17D4F086
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200582.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200896.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Transaction rollback with Camel JBI endpoint

Posted by tranchida <gi...@tranchida.ch>.
Probably the version 2009.02 fix this bug

http://issues.apache.org/activemq/browse/SMXCOMP-651




Raphaël Delaporte wrote:
> 
> I'm using the SMX 3.3.1 with 2009.01 version (JMS & Camel).
> I was thinking the same thing ... Looks like the JMS consumer never got
> the
> DONE;
> 
> It does the same thing with the ?mep=in-only ...
> 
> 
> OK this works if I do 2 camel routes as you suggested ... Strange isn't it
> ?
> Is it a bug ?
> 
> 
> Raphaël
> 
> 
> 2010/1/17 tranchida <gi...@tranchida.ch>
> 
>>
>> It's look like the jms consumer never receive a done status from camel
>>
>> I don't know maybe it's a bug in servicemix-camel, which version do you
>> use
>> ?
>>
>> You can try to add ?mep=in-only to force an in-only exchange
>>
>> jbi:endpoint:
>> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ?mep=in-out
>>
>> see
>> http://camel.apache.org/how-do-i-set-the-mep-when-interacting-with-jbi.html
>>
>> you can also maybe isolate your route with a camel seda
>>
>> from("jbi:...").to("seda:job");
>>
>> from("seda:job")....
>>
>>
>>
>> Raphaël Delaporte wrote:
>> >
>> > Hi
>> >
>> > Thanks for explaination.
>> > I've been running in other troubles... but this time, I run in a non
>> > transacted routes.
>> >
>> > I've a JMS consumer which calls a Camel JBI endpoint, and if everything
>> > goes
>> > well, calls an other JMS provider to put the message in a queue (this
>> > works
>> > well).
>> > In this Camel endpoint, I want to define an errorHandler which sends
>> the
>> > message to a DLQ for example.
>> >>> errorHandler(deadLetterChannel("jbi:endpoint:
>> > http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));
>> >
>> > On errors, my custom error handler is called and I am able to find my
>> > message in my DLQ (this works well)
>> > But, my JMS consumer doesn't want to take anymore messages. It seems
>> it's
>> > freezed on the last exchange (and servicemix is freezed as well, cannot
>> > shutdown, etc..)
>> >
>> > When I keep the default error handler, or if I set something like this,
>> it
>> > works.
>> >>> errorHandler(deadLetterChannel("log:myClass"));
>> >
>> > Seems I've got trouble when I want to call other JBI endpoints into the
>> > errorHandler.
>> >
>> > Any ideas of what's happen ?
>> >
>> > Thanks for your help.
>> > Raphaël
>> >
>> >
>> > 2010/1/17 tranchida <gi...@tranchida.ch>
>> >
>> >>
>> >> The explanation of autoEnlistInTransaction and the different QOS
>> >> depending
>> >> on
>> >> the flow can be found here ->
>> >> http://servicemix.apache.org/transactions.html
>> >>
>> >> For my usage, I totaly disable jms and jca flow. I use only seda and
>> >> pairs
>> >> of jms consumer/provider for persistence / failover / load balancing.
>> >>
>> >> See ref :
>> >>
>> >>
>> >>
>> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
>> >> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
>> >>
>> >>
>> >>
>> >> Raphaël Delaporte wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> > Thanks for your replies.
>> >> >
>> >> > 1. I did not set the autoEnlistInTransaction="true" in
>> servicemix.xml,
>> >> but
>> >> > I
>> >> > don't understand for what this property is used for. I've just seen
>> >> > "Retrieve the value for automatic transaction enlistment" but it's
>> not
>> >> > very
>> >> > clear for me ...
>> >> >   -> OK it works with this property !! Very good !
>> >> >
>> >> >
>> >> > 2. Ok my MEP is InOnly because it comes from a jms consumer :
>> >> >  - but why have I the transaction rolledback if I specify
>> non-existant
>> >> > targetEndpoint / targetService for example ? Is it because the
>> exchange
>> >> is
>> >> > still on the jms component side ?
>> >> >  - How can I specify an InOut MEP on the jms consumer ?
>> >> >      - the defaultMep property does not exist anymore on the new JMS
>> >> > endpoints
>> >> >      - the synchronous property does not change the MEP
>> >> >
>> >> >
>> >> > 3. Subsidiary question guys.
>> >> > I've seen in the stacktrace when transaction is rolledback that the
>> >> flow
>> >> > used is the SEDA flow. I guess this flow is not persistant at all ..
>> Am
>> >> I
>> >> > wrong ?
>> >> > Is there a way to force this exchange to use other flow, as JMS flow
>> >> for
>> >> > instance ?
>> >> > I commented out the SEDA flow in the servicemix.xml, and it uses the
>> >> JMS
>> >> > flow. But this is not really a good method...
>> >> >
>> >> >
>> >> > Thanks a lot !
>> >> > Raphaël
>> >> >
>> >> >
>> >> >
>> >> > 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
>> >> >
>> >> >> Hi Raph,
>> >> >>
>> >> >> be careful, as your MEP is InOnly, in case of error, it can't go
>> back
>> >> to
>> >> >> the JMS endpoint.
>> >> >>
>> >> >> Try to use InOut MEP, it should be better.
>> >> >>
>> >> >> Regards
>> >> >> JB
>> >> >>
>> >> >>
>> >> >> 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.SedaQueue$1@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
>> >> >>>
>> >> >>>
>> >> >> --
>> >> >> Jean-Baptiste Onofré
>> >> >> ---------------------------------
>> >> >>  HomePage
>> >> >> http://www.nanthrax.net
>> >> >> ---------------------------------
>> >> >>  Contacts
>> >> >> jbonofre@apache.org
>> >> >> jb@nanthrax.net
>> >> >> ---------------------------------
>> >> >>  OpenSource
>> >> >> BuildProcess/AutoDeploy
>> >> >> http://buildprocess.sourceforge.net
>> >> >> Apache ServiceMix
>> >> >> http://servicemix.apache.org
>> >> >> -----------------------------------
>> >> >> PGP : 17D4F086
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200582.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200896.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Transaction rollback with Camel JBI endpoint

Posted by Raphaël Delaporte <ra...@gmail.com>.
I'm using the SMX 3.3.1 with 2009.01 version (JMS & Camel).
I was thinking the same thing ... Looks like the JMS consumer never got the
DONE;

It does the same thing with the ?mep=in-only ...


OK this works if I do 2 camel routes as you suggested ... Strange isn't it ?
Is it a bug ?


Raphaël


2010/1/17 tranchida <gi...@tranchida.ch>

>
> It's look like the jms consumer never receive a done status from camel
>
> I don't know maybe it's a bug in servicemix-camel, which version do you use
> ?
>
> You can try to add ?mep=in-only to force an in-only exchange
>
> jbi:endpoint:
> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ?mep=in-out
>
> see
> http://camel.apache.org/how-do-i-set-the-mep-when-interacting-with-jbi.html
>
> you can also maybe isolate your route with a camel seda
>
> from("jbi:...").to("seda:job");
>
> from("seda:job")....
>
>
>
> Raphaël Delaporte wrote:
> >
> > Hi
> >
> > Thanks for explaination.
> > I've been running in other troubles... but this time, I run in a non
> > transacted routes.
> >
> > I've a JMS consumer which calls a Camel JBI endpoint, and if everything
> > goes
> > well, calls an other JMS provider to put the message in a queue (this
> > works
> > well).
> > In this Camel endpoint, I want to define an errorHandler which sends the
> > message to a DLQ for example.
> >>> errorHandler(deadLetterChannel("jbi:endpoint:
> > http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));
> >
> > On errors, my custom error handler is called and I am able to find my
> > message in my DLQ (this works well)
> > But, my JMS consumer doesn't want to take anymore messages. It seems it's
> > freezed on the last exchange (and servicemix is freezed as well, cannot
> > shutdown, etc..)
> >
> > When I keep the default error handler, or if I set something like this,
> it
> > works.
> >>> errorHandler(deadLetterChannel("log:myClass"));
> >
> > Seems I've got trouble when I want to call other JBI endpoints into the
> > errorHandler.
> >
> > Any ideas of what's happen ?
> >
> > Thanks for your help.
> > Raphaël
> >
> >
> > 2010/1/17 tranchida <gi...@tranchida.ch>
> >
> >>
> >> The explanation of autoEnlistInTransaction and the different QOS
> >> depending
> >> on
> >> the flow can be found here ->
> >> http://servicemix.apache.org/transactions.html
> >>
> >> For my usage, I totaly disable jms and jca flow. I use only seda and
> >> pairs
> >> of jms consumer/provider for persistence / failover / load balancing.
> >>
> >> See ref :
> >>
> >>
> >>
> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
> >> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
> >>
> >>
> >>
> >> Raphaël Delaporte wrote:
> >> >
> >> > Hi,
> >> >
> >> > Thanks for your replies.
> >> >
> >> > 1. I did not set the autoEnlistInTransaction="true" in servicemix.xml,
> >> but
> >> > I
> >> > don't understand for what this property is used for. I've just seen
> >> > "Retrieve the value for automatic transaction enlistment" but it's not
> >> > very
> >> > clear for me ...
> >> >   -> OK it works with this property !! Very good !
> >> >
> >> >
> >> > 2. Ok my MEP is InOnly because it comes from a jms consumer :
> >> >  - but why have I the transaction rolledback if I specify non-existant
> >> > targetEndpoint / targetService for example ? Is it because the
> exchange
> >> is
> >> > still on the jms component side ?
> >> >  - How can I specify an InOut MEP on the jms consumer ?
> >> >      - the defaultMep property does not exist anymore on the new JMS
> >> > endpoints
> >> >      - the synchronous property does not change the MEP
> >> >
> >> >
> >> > 3. Subsidiary question guys.
> >> > I've seen in the stacktrace when transaction is rolledback that the
> >> flow
> >> > used is the SEDA flow. I guess this flow is not persistant at all ..
> Am
> >> I
> >> > wrong ?
> >> > Is there a way to force this exchange to use other flow, as JMS flow
> >> for
> >> > instance ?
> >> > I commented out the SEDA flow in the servicemix.xml, and it uses the
> >> JMS
> >> > flow. But this is not really a good method...
> >> >
> >> >
> >> > Thanks a lot !
> >> > Raphaël
> >> >
> >> >
> >> >
> >> > 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
> >> >
> >> >> Hi Raph,
> >> >>
> >> >> be careful, as your MEP is InOnly, in case of error, it can't go back
> >> to
> >> >> the JMS endpoint.
> >> >>
> >> >> Try to use InOut MEP, it should be better.
> >> >>
> >> >> Regards
> >> >> JB
> >> >>
> >> >>
> >> >> 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.SedaQueue$1@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
> >> >>>
> >> >>>
> >> >> --
> >> >> Jean-Baptiste Onofré
> >> >> ---------------------------------
> >> >>  HomePage
> >> >> http://www.nanthrax.net
> >> >> ---------------------------------
> >> >>  Contacts
> >> >> jbonofre@apache.org
> >> >> jb@nanthrax.net
> >> >> ---------------------------------
> >> >>  OpenSource
> >> >> BuildProcess/AutoDeploy
> >> >> http://buildprocess.sourceforge.net
> >> >> Apache ServiceMix
> >> >> http://servicemix.apache.org
> >> >> -----------------------------------
> >> >> PGP : 17D4F086
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200582.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Transaction rollback with Camel JBI endpoint

Posted by tranchida <gi...@tranchida.ch>.
It's look like the jms consumer never receive a done status from camel

I don't know maybe it's a bug in servicemix-camel, which version do you use
?

You can try to add ?mep=in-only to force an in-only exchange 

jbi:endpoint:
http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ?mep=in-out

see
http://camel.apache.org/how-do-i-set-the-mep-when-interacting-with-jbi.html

you can also maybe isolate your route with a camel seda 

from("jbi:...").to("seda:job"); 

from("seda:job")....



Raphaël Delaporte wrote:
> 
> Hi
> 
> Thanks for explaination.
> I've been running in other troubles... but this time, I run in a non
> transacted routes.
> 
> I've a JMS consumer which calls a Camel JBI endpoint, and if everything
> goes
> well, calls an other JMS provider to put the message in a queue (this
> works
> well).
> In this Camel endpoint, I want to define an errorHandler which sends the
> message to a DLQ for example.
>>> errorHandler(deadLetterChannel("jbi:endpoint:
> http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));
> 
> On errors, my custom error handler is called and I am able to find my
> message in my DLQ (this works well)
> But, my JMS consumer doesn't want to take anymore messages. It seems it's
> freezed on the last exchange (and servicemix is freezed as well, cannot
> shutdown, etc..)
> 
> When I keep the default error handler, or if I set something like this, it
> works.
>>> errorHandler(deadLetterChannel("log:myClass"));
> 
> Seems I've got trouble when I want to call other JBI endpoints into the
> errorHandler.
> 
> Any ideas of what's happen ?
> 
> Thanks for your help.
> Raphaël
> 
> 
> 2010/1/17 tranchida <gi...@tranchida.ch>
> 
>>
>> The explanation of autoEnlistInTransaction and the different QOS
>> depending
>> on
>> the flow can be found here ->
>> http://servicemix.apache.org/transactions.html
>>
>> For my usage, I totaly disable jms and jca flow. I use only seda and
>> pairs
>> of jms consumer/provider for persistence / failover / load balancing.
>>
>> See ref :
>>
>>
>> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
>> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
>>
>>
>>
>> Raphaël Delaporte wrote:
>> >
>> > Hi,
>> >
>> > Thanks for your replies.
>> >
>> > 1. I did not set the autoEnlistInTransaction="true" in servicemix.xml,
>> but
>> > I
>> > don't understand for what this property is used for. I've just seen
>> > "Retrieve the value for automatic transaction enlistment" but it's not
>> > very
>> > clear for me ...
>> >   -> OK it works with this property !! Very good !
>> >
>> >
>> > 2. Ok my MEP is InOnly because it comes from a jms consumer :
>> >  - but why have I the transaction rolledback if I specify non-existant
>> > targetEndpoint / targetService for example ? Is it because the exchange
>> is
>> > still on the jms component side ?
>> >  - How can I specify an InOut MEP on the jms consumer ?
>> >      - the defaultMep property does not exist anymore on the new JMS
>> > endpoints
>> >      - the synchronous property does not change the MEP
>> >
>> >
>> > 3. Subsidiary question guys.
>> > I've seen in the stacktrace when transaction is rolledback that the
>> flow
>> > used is the SEDA flow. I guess this flow is not persistant at all .. Am
>> I
>> > wrong ?
>> > Is there a way to force this exchange to use other flow, as JMS flow
>> for
>> > instance ?
>> > I commented out the SEDA flow in the servicemix.xml, and it uses the
>> JMS
>> > flow. But this is not really a good method...
>> >
>> >
>> > Thanks a lot !
>> > Raphaël
>> >
>> >
>> >
>> > 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
>> >
>> >> Hi Raph,
>> >>
>> >> be careful, as your MEP is InOnly, in case of error, it can't go back
>> to
>> >> the JMS endpoint.
>> >>
>> >> Try to use InOut MEP, it should be better.
>> >>
>> >> Regards
>> >> JB
>> >>
>> >>
>> >> 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.SedaQueue$1@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
>> >>>
>> >>>
>> >> --
>> >> Jean-Baptiste Onofré
>> >> ---------------------------------
>> >>  HomePage
>> >> http://www.nanthrax.net
>> >> ---------------------------------
>> >>  Contacts
>> >> jbonofre@apache.org
>> >> jb@nanthrax.net
>> >> ---------------------------------
>> >>  OpenSource
>> >> BuildProcess/AutoDeploy
>> >> http://buildprocess.sourceforge.net
>> >> Apache ServiceMix
>> >> http://servicemix.apache.org
>> >> -----------------------------------
>> >> PGP : 17D4F086
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200582.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Transaction rollback with Camel JBI endpoint

Posted by Raphaël Delaporte <ra...@gmail.com>.
Hi

Thanks for explaination.
I've been running in other troubles... but this time, I run in a non
transacted routes.

I've a JMS consumer which calls a Camel JBI endpoint, and if everything goes
well, calls an other JMS provider to put the message in a queue (this works
well).
In this Camel endpoint, I want to define an errorHandler which sends the
message to a DLQ for example.
>> errorHandler(deadLetterChannel("jbi:endpoint:
http://esb/jmsProviderErreursDLQ/jmsProviderErreursDLQ"));

On errors, my custom error handler is called and I am able to find my
message in my DLQ (this works well)
But, my JMS consumer doesn't want to take anymore messages. It seems it's
freezed on the last exchange (and servicemix is freezed as well, cannot
shutdown, etc..)

When I keep the default error handler, or if I set something like this, it
works.
>> errorHandler(deadLetterChannel("log:myClass"));

Seems I've got trouble when I want to call other JBI endpoints into the
errorHandler.

Any ideas of what's happen ?

Thanks for your help.
Raphaël


2010/1/17 tranchida <gi...@tranchida.ch>

>
> The explanation of autoEnlistInTransaction and the different QOS depending
> on
> the flow can be found here ->
> http://servicemix.apache.org/transactions.html
>
> For my usage, I totaly disable jms and jca flow. I use only seda and pairs
> of jms consumer/provider for persistence / failover / load balancing.
>
> See ref :
>
>
> http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html
> http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html
>
>
>
> Raphaël Delaporte wrote:
> >
> > Hi,
> >
> > Thanks for your replies.
> >
> > 1. I did not set the autoEnlistInTransaction="true" in servicemix.xml,
> but
> > I
> > don't understand for what this property is used for. I've just seen
> > "Retrieve the value for automatic transaction enlistment" but it's not
> > very
> > clear for me ...
> >   -> OK it works with this property !! Very good !
> >
> >
> > 2. Ok my MEP is InOnly because it comes from a jms consumer :
> >  - but why have I the transaction rolledback if I specify non-existant
> > targetEndpoint / targetService for example ? Is it because the exchange
> is
> > still on the jms component side ?
> >  - How can I specify an InOut MEP on the jms consumer ?
> >      - the defaultMep property does not exist anymore on the new JMS
> > endpoints
> >      - the synchronous property does not change the MEP
> >
> >
> > 3. Subsidiary question guys.
> > I've seen in the stacktrace when transaction is rolledback that the flow
> > used is the SEDA flow. I guess this flow is not persistant at all .. Am I
> > wrong ?
> > Is there a way to force this exchange to use other flow, as JMS flow for
> > instance ?
> > I commented out the SEDA flow in the servicemix.xml, and it uses the JMS
> > flow. But this is not really a good method...
> >
> >
> > Thanks a lot !
> > Raphaël
> >
> >
> >
> > 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
> >
> >> Hi Raph,
> >>
> >> be careful, as your MEP is InOnly, in case of error, it can't go back to
> >> the JMS endpoint.
> >>
> >> Try to use InOut MEP, it should be better.
> >>
> >> Regards
> >> JB
> >>
> >>
> >> 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.SedaQueue$1@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
> >>>
> >>>
> >> --
> >> Jean-Baptiste Onofré
> >> ---------------------------------
> >>  HomePage
> >> http://www.nanthrax.net
> >> ---------------------------------
> >>  Contacts
> >> jbonofre@apache.org
> >> jb@nanthrax.net
> >> ---------------------------------
> >>  OpenSource
> >> BuildProcess/AutoDeploy
> >> http://buildprocess.sourceforge.net
> >> Apache ServiceMix
> >> http://servicemix.apache.org
> >> -----------------------------------
> >> PGP : 17D4F086
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Transaction rollback with Camel JBI endpoint

Posted by tranchida <gi...@tranchida.ch>.
The explanation of autoEnlistInTransaction and the different QOS depending on
the flow can be found here -> http://servicemix.apache.org/transactions.html

For my usage, I totaly disable jms and jca flow. I use only seda and pairs
of jms consumer/provider for persistence / failover / load balancing. 

See ref : 

http://trenaman.blogspot.com/2008/11/jmsjca-flows-in-servicemix-wrong-level.html 
http://trenaman.blogspot.com/2009/03/new-jms-flow-in-servicemix-4.html



Raphaël Delaporte wrote:
> 
> Hi,
> 
> Thanks for your replies.
> 
> 1. I did not set the autoEnlistInTransaction="true" in servicemix.xml, but
> I
> don't understand for what this property is used for. I've just seen
> "Retrieve the value for automatic transaction enlistment" but it's not
> very
> clear for me ...
>   -> OK it works with this property !! Very good !
> 
> 
> 2. Ok my MEP is InOnly because it comes from a jms consumer :
>  - but why have I the transaction rolledback if I specify non-existant
> targetEndpoint / targetService for example ? Is it because the exchange is
> still on the jms component side ?
>  - How can I specify an InOut MEP on the jms consumer ?
>      - the defaultMep property does not exist anymore on the new JMS
> endpoints
>      - the synchronous property does not change the MEP
> 
> 
> 3. Subsidiary question guys.
> I've seen in the stacktrace when transaction is rolledback that the flow
> used is the SEDA flow. I guess this flow is not persistant at all .. Am I
> wrong ?
> Is there a way to force this exchange to use other flow, as JMS flow for
> instance ?
> I commented out the SEDA flow in the servicemix.xml, and it uses the JMS
> flow. But this is not really a good method...
> 
> 
> Thanks a lot !
> Raphaël
> 
> 
> 
> 2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>
> 
>> Hi Raph,
>>
>> be careful, as your MEP is InOnly, in case of error, it can't go back to
>> the JMS endpoint.
>>
>> Try to use InOut MEP, it should be better.
>>
>> Regards
>> JB
>>
>>
>> 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.SedaQueue$1@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
>>>
>>>
>> --
>> Jean-Baptiste Onofré
>> ---------------------------------
>>  HomePage
>> http://www.nanthrax.net
>> ---------------------------------
>>  Contacts
>> jbonofre@apache.org
>> jb@nanthrax.net
>> ---------------------------------
>>  OpenSource
>> BuildProcess/AutoDeploy
>> http://buildprocess.sourceforge.net
>> Apache ServiceMix
>> http://servicemix.apache.org
>> -----------------------------------
>> PGP : 17D4F086
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Transaction-rollback-with-Camel-JBI-endpoint-tp27193847p27200109.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Transaction rollback with Camel JBI endpoint

Posted by Raphaël Delaporte <ra...@gmail.com>.
Hi,

Thanks for your replies.

1. I did not set the autoEnlistInTransaction="true" in servicemix.xml, but I
don't understand for what this property is used for. I've just seen
"Retrieve the value for automatic transaction enlistment" but it's not very
clear for me ...
  -> OK it works with this property !! Very good !


2. Ok my MEP is InOnly because it comes from a jms consumer :
 - but why have I the transaction rolledback if I specify non-existant
targetEndpoint / targetService for example ? Is it because the exchange is
still on the jms component side ?
 - How can I specify an InOut MEP on the jms consumer ?
     - the defaultMep property does not exist anymore on the new JMS
endpoints
     - the synchronous property does not change the MEP


3. Subsidiary question guys.
I've seen in the stacktrace when transaction is rolledback that the flow
used is the SEDA flow. I guess this flow is not persistant at all .. Am I
wrong ?
Is there a way to force this exchange to use other flow, as JMS flow for
instance ?
I commented out the SEDA flow in the servicemix.xml, and it uses the JMS
flow. But this is not really a good method...


Thanks a lot !
Raphaël



2010/1/17 Jean-Baptiste Onofre <jb...@nanthrax.net>

> Hi Raph,
>
> be careful, as your MEP is InOnly, in case of error, it can't go back to
> the JMS endpoint.
>
> Try to use InOut MEP, it should be better.
>
> Regards
> JB
>
>
> 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.SedaQueue$1@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
>>
>>
> --
> Jean-Baptiste Onofré
> ---------------------------------
>  HomePage
> http://www.nanthrax.net
> ---------------------------------
>  Contacts
> jbonofre@apache.org
> jb@nanthrax.net
> ---------------------------------
>  OpenSource
> BuildProcess/AutoDeploy
> http://buildprocess.sourceforge.net
> Apache ServiceMix
> http://servicemix.apache.org
> -----------------------------------
> PGP : 17D4F086
>

Re: Transaction rollback with Camel JBI endpoint

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Raph,

be careful, as your MEP is InOnly, in case of error, it can't go back to 
the JMS endpoint.

Try to use InOut MEP, it should be better.

Regards
JB

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.SedaQueue$1@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
> 

-- 
Jean-Baptiste Onofré
---------------------------------
  HomePage
http://www.nanthrax.net
---------------------------------
  Contacts
jbonofre@apache.org
jb@nanthrax.net
---------------------------------
  OpenSource
BuildProcess/AutoDeploy
http://buildprocess.sourceforge.net
Apache ServiceMix
http://servicemix.apache.org
-----------------------------------
PGP : 17D4F086

Re: Transaction rollback with Camel JBI endpoint

Posted by Freeman Fang <fr...@gmail.com>.
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.SedaQueue$1@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