You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Filippo Balicchia <fb...@gmail.com> on 2012/01/16 19:11:32 UTC

create a transacted policy with camel

Hello i try to use transaction from camel in osgi bundle.

My route look like this

from("jms:myqueue").transacted().id("DestRoute").throwException(new
Exception("persistence error"))
And i my configuration look like this:

<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
	<property name="connectionFactory">
			<osgi:reference interface="javax.jms.ConnectionFactory" />
	</property>
	<property name="transacted" value="true" />
	<property name="transactionManager">
		<osgi:reference
			interface="org.springframework.transaction.PlatformTransactionManager" />
	</property>
</bean>

<camelContext xmlns="http://camel.apache.org/schema/spring">
		<routeBuilder ref="destRoute" />
</camelContext>

At bundle startup it tell me that that doesn't find camel-spring
'Cannot create a transacted policy as camel-spring.jar is not on the classpath'
It 'very clear but in my header package
org.springframework.transaction
org.apache.camel.spring
are present.

Where am I mistaken or forgotten, or what?

Re: create a transacted policy with camel

Posted by Filippo Balicchia <fb...@gmail.com>.
Sorry surely

from("jms:myqueue").transacted("PROPAGATION_REQUIRED").id("DestRoute").throwException(new
Exception("persistence error"))

In spring file definition

<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
		<property name="transactionManager">
			<osgi:reference
				interface="org.springframework.transaction.PlatformTransactionManager" />
		</property>
			<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />
</bean>



Il 17 gennaio 2012 07:31, Claus Ibsen <cl...@gmail.com> ha scritto:
> On Tue, Jan 17, 2012 at 7:24 AM, Filippo Balicchia <fb...@gmail.com> wrote:
>> Thanks to all
>> I have resolved
>>
>
> Do you mind sharing your solution?
> So others who have a similar issue, can read your solution.
>
>
>> Il 16 gennaio 2012 19:11, Filippo Balicchia <fb...@gmail.com> ha scritto:
>>> Hello i try to use transaction from camel in osgi bundle.
>>>
>>> My route look like this
>>>
>>> from("jms:myqueue").transacted().id("DestRoute").throwException(new
>>> Exception("persistence error"))
>>> And i my configuration look like this:
>>>
>>> <bean id="activemq"
>>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>>        <property name="connectionFactory">
>>>                        <osgi:reference interface="javax.jms.ConnectionFactory" />
>>>        </property>
>>>        <property name="transacted" value="true" />
>>>        <property name="transactionManager">
>>>                <osgi:reference
>>>                        interface="org.springframework.transaction.PlatformTransactionManager" />
>>>        </property>
>>> </bean>
>>>
>>> <camelContext xmlns="http://camel.apache.org/schema/spring">
>>>                <routeBuilder ref="destRoute" />
>>> </camelContext>
>>>
>>> At bundle startup it tell me that that doesn't find camel-spring
>>> 'Cannot create a transacted policy as camel-spring.jar is not on the classpath'
>>> It 'very clear but in my header package
>>> org.springframework.transaction
>>> org.apache.camel.spring
>>> are present.
>>>
>>> Where am I mistaken or forgotten, or what?
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/

Re: create a transacted policy with camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 17, 2012 at 7:24 AM, Filippo Balicchia <fb...@gmail.com> wrote:
> Thanks to all
> I have resolved
>

Do you mind sharing your solution?
So others who have a similar issue, can read your solution.


> Il 16 gennaio 2012 19:11, Filippo Balicchia <fb...@gmail.com> ha scritto:
>> Hello i try to use transaction from camel in osgi bundle.
>>
>> My route look like this
>>
>> from("jms:myqueue").transacted().id("DestRoute").throwException(new
>> Exception("persistence error"))
>> And i my configuration look like this:
>>
>> <bean id="activemq"
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>        <property name="connectionFactory">
>>                        <osgi:reference interface="javax.jms.ConnectionFactory" />
>>        </property>
>>        <property name="transacted" value="true" />
>>        <property name="transactionManager">
>>                <osgi:reference
>>                        interface="org.springframework.transaction.PlatformTransactionManager" />
>>        </property>
>> </bean>
>>
>> <camelContext xmlns="http://camel.apache.org/schema/spring">
>>                <routeBuilder ref="destRoute" />
>> </camelContext>
>>
>> At bundle startup it tell me that that doesn't find camel-spring
>> 'Cannot create a transacted policy as camel-spring.jar is not on the classpath'
>> It 'very clear but in my header package
>> org.springframework.transaction
>> org.apache.camel.spring
>> are present.
>>
>> Where am I mistaken or forgotten, or what?



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: create a transacted policy with camel

Posted by Filippo Balicchia <fb...@gmail.com>.
Thanks to all
I have resolved

Il 16 gennaio 2012 19:11, Filippo Balicchia <fb...@gmail.com> ha scritto:
> Hello i try to use transaction from camel in osgi bundle.
>
> My route look like this
>
> from("jms:myqueue").transacted().id("DestRoute").throwException(new
> Exception("persistence error"))
> And i my configuration look like this:
>
> <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>        <property name="connectionFactory">
>                        <osgi:reference interface="javax.jms.ConnectionFactory" />
>        </property>
>        <property name="transacted" value="true" />
>        <property name="transactionManager">
>                <osgi:reference
>                        interface="org.springframework.transaction.PlatformTransactionManager" />
>        </property>
> </bean>
>
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>                <routeBuilder ref="destRoute" />
> </camelContext>
>
> At bundle startup it tell me that that doesn't find camel-spring
> 'Cannot create a transacted policy as camel-spring.jar is not on the classpath'
> It 'very clear but in my header package
> org.springframework.transaction
> org.apache.camel.spring
> are present.
>
> Where am I mistaken or forgotten, or what?