简体   繁体   中英

What is the difference between a transactional client and transacted=true when using a JMS route in apache camel?

I have a camel route where the from and to endpoints are jms. I also have error handling ON.

Now, I wanna protect this message handling with a jms transaction handler. For that I have two options:

  1. Either configure the route to use as shown here
  2. Or just configure the JMS endpoints to use transacted=true as shown here

What is the difference between two? Can anybody tell me which one is better and which to use?

According to this (see Claus Ibsen's answer) <transacted> ensures the Camel processing runs inside a TX context. Where as without that the TX context is only for the broker (and only within the same unit of work from the same JMS session). Whereas transacted=true enables transactional consuming of messages. There's also an example there of where you would actually want to use <transacted> (consuming from http endpoint):

from jetty:http
transacted
to jms
to file

So if you're just passing messages from one JMS endpoint to another on sthe same broker, seems like you don't actually need a transacted route.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM