You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by PeterNilsson <pe...@gmail.com> on 2006/08/28 10:15:13 UTC

Transaction propagation

We use ServiceMix for implementing nodes in an ESB. Our setup is:
- Only straight through flow
- Message exchanges are not transactional
- Synchronous calls within a node, ie as long as we stay within the JBI
container
- JMS between nodes (Active MQ 4.01)
- Incoming JMS, outgoing JMS and database calls need to be in same
transaction.
- We use JmsInUsingJCABinding together with Jencks for incoming JMS

As I understand it a transaction will automatically be started and committed
by JmsInUsingJCABinding (or rather Jencks) so our problem is: How do we
propagate the transaction to the service engines doing the database calls
and the binding components doing outbound JMS?

Even though we use straight through flow there are multiple threads involved
so I assume we have to pick the transaction from the thread before sendSync
and put it in a property instead and vice versa when receiving. Is this the
correct approach and is there any support for it?

A related issue: as I have understood the JmsInUsingJCABinding always sends
asyncronously which would be a problem for us (commit can occur before the
flow has been completed). Has anybody else solved this? I guess we could
simply implement our own binding component instead of JmsInUsingJCABinding.

   Peter
-- 
View this message in context: http://www.nabble.com/Transaction-propagation-tf2175878.html#a6016142
Sent from the ServiceMix - User forum at Nabble.com.


Re: Transaction propagation

Posted by Guillaume Nodet <gn...@gmail.com>.
See the newly update page (thx to Terry for that)
http://servicemix.goopen.org/site/transactions.html
It should answer your questions.

Note that the only component that start a transaction is the servicemix-jms
using jca
for a consumer endpoint (or its lightweight counterpart).

On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
>
>
> Ok, I have to discuss with my team about how to do about the
> send/sendSync.
>
> What about the first question I had: "How do we propagate the transaction
> to
> the service engines doing the database calls and the binding components
> doing outbound JMS?"
> Does servicemix propagate the transaction automatically or do I need to
> pick
> it off the thread and put it in a NormalizedMessage property manually?
> Notice that we have no interest in using transactional message exchanges
> but
> only transactions in jms binding components and database access.
>
> Thanks for your swift answers.
>
>    Peter
>
>
>
>
> gnodet wrote:
> >
> > Use a snapshot version or hack the lightweight jms receiver to performs
> a
> > send / sendSync depending on an optional flag.  If you have a patch,
> feel
> > free to raise a JIRA and attach it :)
> >
> > On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
> >>
> >>
> >> I tried modifying our setup according to the example, I run into
> problems
> >> however because we are running 3.0M2 and the example tries to setup
> >> resourceAdapter and bootstrapContext on JmsEndpoint. Those properties
> are
> >> not available in 3.0M2.
> >> Is the another way to obtain the same effect?
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > The new servicemix-jms component supports JCA and can be configured
> >> > to send exchanges synchronously or asynchronously.
> >> > See
> >> >
> >>
> http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/test/resources/org/apache/servicemix/jms/spring-jca.xml?revision=432892&view=markup
> >> > for an sample configuration.
> >> >
> >> > On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
> >> >>
> >> >>
> >> >> We use ServiceMix for implementing nodes in an ESB. Our setup is:
> >> >> - Only straight through flow
> >> >> - Message exchanges are not transactional
> >> >> - Synchronous calls within a node, ie as long as we stay within the
> >> JBI
> >> >> container
> >> >> - JMS between nodes (Active MQ 4.01)
> >> >> - Incoming JMS, outgoing JMS and database calls need to be in same
> >> >> transaction.
> >> >> - We use JmsInUsingJCABinding together with Jencks for incoming JMS
> >> >>
> >> >> As I understand it a transaction will automatically be started and
> >> >> committed
> >> >> by JmsInUsingJCABinding (or rather Jencks) so our problem is: How do
> >> we
> >> >> propagate the transaction to the service engines doing the database
> >> calls
> >> >> and the binding components doing outbound JMS?
> >> >>
> >> >> Even though we use straight through flow there are multiple threads
> >> >> involved
> >> >> so I assume we have to pick the transaction from the thread before
> >> >> sendSync
> >> >> and put it in a property instead and vice versa when receiving. Is
> >> this
> >> >> the
> >> >> correct approach and is there any support for it?
> >> >>
> >> >> A related issue: as I have understood the JmsInUsingJCABinding
> always
> >> >> sends
> >> >> asyncronously which would be a problem for us (commit can occur
> before
> >> >> the
> >> >> flow has been completed). Has anybody else solved this? I guess we
> >> could
> >> >> simply implement our own binding component instead of
> >> >> JmsInUsingJCABinding.
> >> >>
> >> >>    Peter
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6016142
> >> >> Sent from the ServiceMix - User forum at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6020391
> >> Sent from the ServiceMix - User forum at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6021254
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: Transaction propagation

Posted by PeterNilsson <pe...@gmail.com>.
Ok, I have to discuss with my team about how to do about the send/sendSync.

What about the first question I had: "How do we propagate the transaction to
the service engines doing the database calls and the binding components
doing outbound JMS?"
Does servicemix propagate the transaction automatically or do I need to pick
it off the thread and put it in a NormalizedMessage property manually?
Notice that we have no interest in using transactional message exchanges but
only transactions in jms binding components and database access.

Thanks for your swift answers.

   Peter




gnodet wrote:
> 
> Use a snapshot version or hack the lightweight jms receiver to performs a
> send / sendSync depending on an optional flag.  If you have a patch, feel
> free to raise a JIRA and attach it :)
> 
> On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
>>
>>
>> I tried modifying our setup according to the example, I run into problems
>> however because we are running 3.0M2 and the example tries to setup
>> resourceAdapter and bootstrapContext on JmsEndpoint. Those properties are
>> not available in 3.0M2.
>> Is the another way to obtain the same effect?
>>
>>
>>
>> gnodet wrote:
>> >
>> > The new servicemix-jms component supports JCA and can be configured
>> > to send exchanges synchronously or asynchronously.
>> > See
>> >
>> http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/test/resources/org/apache/servicemix/jms/spring-jca.xml?revision=432892&view=markup
>> > for an sample configuration.
>> >
>> > On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
>> >>
>> >>
>> >> We use ServiceMix for implementing nodes in an ESB. Our setup is:
>> >> - Only straight through flow
>> >> - Message exchanges are not transactional
>> >> - Synchronous calls within a node, ie as long as we stay within the
>> JBI
>> >> container
>> >> - JMS between nodes (Active MQ 4.01)
>> >> - Incoming JMS, outgoing JMS and database calls need to be in same
>> >> transaction.
>> >> - We use JmsInUsingJCABinding together with Jencks for incoming JMS
>> >>
>> >> As I understand it a transaction will automatically be started and
>> >> committed
>> >> by JmsInUsingJCABinding (or rather Jencks) so our problem is: How do
>> we
>> >> propagate the transaction to the service engines doing the database
>> calls
>> >> and the binding components doing outbound JMS?
>> >>
>> >> Even though we use straight through flow there are multiple threads
>> >> involved
>> >> so I assume we have to pick the transaction from the thread before
>> >> sendSync
>> >> and put it in a property instead and vice versa when receiving. Is
>> this
>> >> the
>> >> correct approach and is there any support for it?
>> >>
>> >> A related issue: as I have understood the JmsInUsingJCABinding always
>> >> sends
>> >> asyncronously which would be a problem for us (commit can occur before
>> >> the
>> >> flow has been completed). Has anybody else solved this? I guess we
>> could
>> >> simply implement our own binding component instead of
>> >> JmsInUsingJCABinding.
>> >>
>> >>    Peter
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6016142
>> >> Sent from the ServiceMix - User forum at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6020391
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: http://www.nabble.com/Transaction-propagation-tf2175878.html#a6021254
Sent from the ServiceMix - User forum at Nabble.com.


Re: Transaction propagation

Posted by Guillaume Nodet <gn...@gmail.com>.
Use a snapshot version or hack the lightweight jms receiver to performs a
send / sendSync depending on an optional flag.  If you have a patch, feel
free to raise a JIRA and attach it :)

On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
>
>
> I tried modifying our setup according to the example, I run into problems
> however because we are running 3.0M2 and the example tries to setup
> resourceAdapter and bootstrapContext on JmsEndpoint. Those properties are
> not available in 3.0M2.
> Is the another way to obtain the same effect?
>
>
>
> gnodet wrote:
> >
> > The new servicemix-jms component supports JCA and can be configured
> > to send exchanges synchronously or asynchronously.
> > See
> >
> http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/test/resources/org/apache/servicemix/jms/spring-jca.xml?revision=432892&view=markup
> > for an sample configuration.
> >
> > On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
> >>
> >>
> >> We use ServiceMix for implementing nodes in an ESB. Our setup is:
> >> - Only straight through flow
> >> - Message exchanges are not transactional
> >> - Synchronous calls within a node, ie as long as we stay within the JBI
> >> container
> >> - JMS between nodes (Active MQ 4.01)
> >> - Incoming JMS, outgoing JMS and database calls need to be in same
> >> transaction.
> >> - We use JmsInUsingJCABinding together with Jencks for incoming JMS
> >>
> >> As I understand it a transaction will automatically be started and
> >> committed
> >> by JmsInUsingJCABinding (or rather Jencks) so our problem is: How do we
> >> propagate the transaction to the service engines doing the database
> calls
> >> and the binding components doing outbound JMS?
> >>
> >> Even though we use straight through flow there are multiple threads
> >> involved
> >> so I assume we have to pick the transaction from the thread before
> >> sendSync
> >> and put it in a property instead and vice versa when receiving. Is this
> >> the
> >> correct approach and is there any support for it?
> >>
> >> A related issue: as I have understood the JmsInUsingJCABinding always
> >> sends
> >> asyncronously which would be a problem for us (commit can occur before
> >> the
> >> flow has been completed). Has anybody else solved this? I guess we
> could
> >> simply implement our own binding component instead of
> >> JmsInUsingJCABinding.
> >>
> >>    Peter
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6016142
> >> Sent from the ServiceMix - User forum at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6020391
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: Transaction propagation

Posted by PeterNilsson <pe...@gmail.com>.
I tried modifying our setup according to the example, I run into problems
however because we are running 3.0M2 and the example tries to setup
resourceAdapter and bootstrapContext on JmsEndpoint. Those properties are
not available in 3.0M2.
Is the another way to obtain the same effect?



gnodet wrote:
> 
> The new servicemix-jms component supports JCA and can be configured
> to send exchanges synchronously or asynchronously.
> See
> http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/test/resources/org/apache/servicemix/jms/spring-jca.xml?revision=432892&view=markup
> for an sample configuration.
> 
> On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
>>
>>
>> We use ServiceMix for implementing nodes in an ESB. Our setup is:
>> - Only straight through flow
>> - Message exchanges are not transactional
>> - Synchronous calls within a node, ie as long as we stay within the JBI
>> container
>> - JMS between nodes (Active MQ 4.01)
>> - Incoming JMS, outgoing JMS and database calls need to be in same
>> transaction.
>> - We use JmsInUsingJCABinding together with Jencks for incoming JMS
>>
>> As I understand it a transaction will automatically be started and
>> committed
>> by JmsInUsingJCABinding (or rather Jencks) so our problem is: How do we
>> propagate the transaction to the service engines doing the database calls
>> and the binding components doing outbound JMS?
>>
>> Even though we use straight through flow there are multiple threads
>> involved
>> so I assume we have to pick the transaction from the thread before
>> sendSync
>> and put it in a property instead and vice versa when receiving. Is this
>> the
>> correct approach and is there any support for it?
>>
>> A related issue: as I have understood the JmsInUsingJCABinding always
>> sends
>> asyncronously which would be a problem for us (commit can occur before
>> the
>> flow has been completed). Has anybody else solved this? I guess we could
>> simply implement our own binding component instead of
>> JmsInUsingJCABinding.
>>
>>    Peter
>> --
>> View this message in context:
>> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6016142
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: http://www.nabble.com/Transaction-propagation-tf2175878.html#a6020391
Sent from the ServiceMix - User forum at Nabble.com.


Re: Transaction propagation

Posted by Guillaume Nodet <gn...@gmail.com>.
The new servicemix-jms component supports JCA and can be configured
to send exchanges synchronously or asynchronously.
See
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/test/resources/org/apache/servicemix/jms/spring-jca.xml?revision=432892&view=markup
for an sample configuration.

On 8/28/06, PeterNilsson <pe...@gmail.com> wrote:
>
>
> We use ServiceMix for implementing nodes in an ESB. Our setup is:
> - Only straight through flow
> - Message exchanges are not transactional
> - Synchronous calls within a node, ie as long as we stay within the JBI
> container
> - JMS between nodes (Active MQ 4.01)
> - Incoming JMS, outgoing JMS and database calls need to be in same
> transaction.
> - We use JmsInUsingJCABinding together with Jencks for incoming JMS
>
> As I understand it a transaction will automatically be started and
> committed
> by JmsInUsingJCABinding (or rather Jencks) so our problem is: How do we
> propagate the transaction to the service engines doing the database calls
> and the binding components doing outbound JMS?
>
> Even though we use straight through flow there are multiple threads
> involved
> so I assume we have to pick the transaction from the thread before
> sendSync
> and put it in a property instead and vice versa when receiving. Is this
> the
> correct approach and is there any support for it?
>
> A related issue: as I have understood the JmsInUsingJCABinding always
> sends
> asyncronously which would be a problem for us (commit can occur before the
> flow has been completed). Has anybody else solved this? I guess we could
> simply implement our own binding component instead of
> JmsInUsingJCABinding.
>
>    Peter
> --
> View this message in context:
> http://www.nabble.com/Transaction-propagation-tf2175878.html#a6016142
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet