Add transaction support from Camel service bindings
---------------------------------------------------
Key: SWITCHYARD-516
URL:
https://issues.jboss.org/browse/SWITCHYARD-516
Project: SwitchYard
Issue Type: Task
Components: component-camel
Reporter: Daniel Bevenius
Assignee: Daniel Bevenius
This task should add transaction support for a Camel service binding. For example you
could have a binding that looks like this:
{noformat}
<sca:service name="SimpleCamelService"
promote="ComponentName/SimpleCamelService">
<camel:binding.camel
configURI="jms://TestQueue?connectionFactory=#ConnectionFactory"
transacted="true"/>
</sca:service>
{noformat}
What will happen behind the scene is that an InboundHandler for this route will be
created. This InboundHandler will create a camel route
that looks like this:
{noformat}
from("jms://TestQueue?connectionFactory=#ConnectionFactory")
.transacted()
.to("switchyard://SimpleCamelService?namespace=urn:camel-core:test:1.0");
{noformat}
Normally the transaction policy to be used would be specified as a bean in a spring
configuration xml element and referenced from the transacted method. If there is only one
bean of type Policy that will be used as in the case above. The policy will be looked up
in the Camel Registry, first using a reference to a bean if one was provided with the
transacted method. If a bean reference was not provided it will look up the Policy using
the type Policy.
In SwitchYard we don't have the ability to specify beans using Spring XML. But since
we control the creation of the route, we can specify a policy() instead of using the
transacted() which enables us to configure a Spring JtaTransactionManager which can then
be used when creating a custom SpringTransactionPolicy. So this might look something like
this:
{noformat}
from("jms://TestQueue?connectionFactory=#ConnectionFactory")
.policy(customSpringTransactionPolicy)
.to("switchyard://SimpleCamelService?namespace=urn:camel-core:test:1.0");
{noformat}
The JtaTransactionManager can be configured with a UserTransaction, a TransactionManager,
JNDI names for these as well. So we should be able to specify a different JNDI location if
required by AS7 for example.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira