You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kov <ko...@nyc.rr.com> on 2015/08/06 19:30:45 UTC

How many JMS transactions within a route?

Taking the example of a JMS-based application that processes messages from a
JMS message bus:

  <camelContext...>
    <route id="step1">
      <from uri="msgbus:q1" />
      <transacted />
      <to uri="msgbus:q2" />
    </route>  
    
  </camelContext>
  * The 'msgbus' token refers to a JmsComponent with a
CachedConnectionFactory and cache level=CACHE_CONSUMER.

What is the expected number of JMS-transactions for the <from> and <to>
endpoints? Playing with this example, it appears that each of the endpoints
gets a separate JMS-transaction. Does anybody know if that is the case? Are
there design or other reasons for that, maybe enabling further options I
haven't considered? Would it be possible for the route to use one
JMS-transaction for both the consume and send? Or would you have to use XA
transactions to make that happen?




--
View this message in context: http://camel.465427.n5.nabble.com/How-many-JMS-transactions-within-a-route-tp5770390.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How many JMS transactions within a route?

Posted by Christian Müller <ch...@gmail.com>.
You can read more about the supported cache options here [1], but
CACHE_CONSUMER is the best option in your case.
XA is not needed, because you only interact with one resource/broker.
I'm not sure whether we have to have two JMS sessions here. May be an JMS
expert can answer this question...

[1] http://camel.apache.org/jms.html

Best,

Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642

On Mon, Aug 10, 2015 at 3:35 AM, kov <ko...@nyc.rr.com> wrote:

> Thanks; to be clear, I'd prefer not to use an XA transaction here, but I'd
> also like to consume from q1 and publish to q2 in a single transaction,
> that's why I asked if an XA transaction was the only choice, even when I'm
> communicating over a single JMS message bus.
>
> Mostly just trying to understand what the expected behavior with that
> configuration is, and what my options for altering it are? Right now, it
> seems that when a route gets built that references my JMSComponent, a
> session is requested from the JMSComponent which just caches one for each
> consumer. This ends up with a session for the consumer of q1, and a
> distinct
> session for the publisher to q2. Is that pretty much how it works? Just
> wondering what variations on caching behavior exists.
>
> Thanks!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-many-JMS-transactions-within-a-route-tp5770390p5770502.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How many JMS transactions within a route?

Posted by kov <ko...@nyc.rr.com>.
Thanks; to be clear, I'd prefer not to use an XA transaction here, but I'd
also like to consume from q1 and publish to q2 in a single transaction,
that's why I asked if an XA transaction was the only choice, even when I'm
communicating over a single JMS message bus.

Mostly just trying to understand what the expected behavior with that
configuration is, and what my options for altering it are? Right now, it
seems that when a route gets built that references my JMSComponent, a
session is requested from the JMSComponent which just caches one for each
consumer. This ends up with a session for the consumer of q1, and a distinct
session for the publisher to q2. Is that pretty much how it works? Just
wondering what variations on caching behavior exists.

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/How-many-JMS-transactions-within-a-route-tp5770390p5770502.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How many JMS transactions within a route?

Posted by Christian Müller <ch...@gmail.com>.
Why want you use XA when you are talking to only one resource?
Camel creates one transaction per transacted route and consumer (as every
consumer is using its own thread). What do you expect instead?

Best,

Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642

On Thu, Aug 6, 2015 at 7:30 PM, kov <ko...@nyc.rr.com> wrote:

> Taking the example of a JMS-based application that processes messages from
> a
> JMS message bus:
>
>   <camelContext...>
>     <route id="step1">
>       <from uri="msgbus:q1" />
>       <transacted />
>       <to uri="msgbus:q2" />
>     </route>
>
>   </camelContext>
>   * The 'msgbus' token refers to a JmsComponent with a
> CachedConnectionFactory and cache level=CACHE_CONSUMER.
>
> What is the expected number of JMS-transactions for the <from> and <to>
> endpoints? Playing with this example, it appears that each of the endpoints
> gets a separate JMS-transaction. Does anybody know if that is the case? Are
> there design or other reasons for that, maybe enabling further options I
> haven't considered? Would it be possible for the route to use one
> JMS-transaction for both the consume and send? Or would you have to use XA
> transactions to make that happen?
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-many-JMS-transactions-within-a-route-tp5770390.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>