If the message is redelivered, this means there is a rollback.
I guess the problem is that your DB is not enlisted in the transaction.
However, if you don't want to use XA and two phase commit, you should
try to perform the database step as late as possible so that there is very few
chances that anything wrong happen after the data has been written to the DB.
Btw, in your route, I don't see at which step the message is written
to the DB ... ?

On Fri, Jul 3, 2009 at 15:26, Charles Moulliard<cmoulli...@gmail.com> wrote:
> I have created a small route without JMS stuff.
>
> Here is the route :
>
>        <camel:route>
>            <camel:from ref="fileClientEndpoint" />
>
>            <camel:setHeader headerName="origin">
>                <camel:constant>file</camel:constant>
>            </camel:setHeader>
>            <camel:setHeader headerName="messageType">
>                <camel:constant>OINP</camel:constant>
>            </camel:setHeader>
>            <camel:convertBodyTo type="java.lang.String"/>
>            <camel:to ref="directRequestEndpoint" />
>        </camel:route>
>
>        <camel:route>
>            <camel:from ref="directRequestEndpoint" />
>            <camel:transacted ref="PROPAGATION_REQUIRED"/>
>            <!-- Call the requestService to save the request -->
>            <camel:bean ref="serviceHelper" method="createRequest"/>
>            <camel:bean ref="serviceHelper" method="generateError" />
>            <camel:to uri="direct:testTx"/>
>        </camel:route>
>
> Unfortunately when a throw error is generated in bean called "generateError"
>
>    public void generateError() {
>            throw new IllegalArgumentException("Generate error to test
> rollback");
>    }
>
> records are committed in the DB and not rollbacked
>
>
> I see that when the error is throw the message is redelivered a second time
> as this parameter has been defined in the ActiveMq
>
>    <bean id="x3sPolicy" class="org.apache.activemq.RedeliveryPolicy">
> *        <property name="maximumRedeliveries" value="1"/>*
>    </bean>
>
>    <bean id="activemqConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>        <property name="brokerURL" value="tcp://localhost:61616" />
>        <property name="redeliveryPolicy" ref="x3sPolicy"/>
>    </bean>
>
> Question :  Why policy defined in the ActiveMq is taken into account here ?
> Why the rollback does not occur ?
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Fri, Jul 3, 2009 at 12:28 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>
>> On Fri, Jul 3, 2009 at 12:16 PM, Guillaume Nodet<gno...@gmail.com> wrote:
>> > In this case, you should not use transactions for the DB at all, but
>> > if any error occurs while saving the data, an exception should be
>> > thrown and should rollback the transaction for the JMS layer.
>> Yeah that would be perfect unless he does some work afterwards the DB
>> and that throws an Exception.
>> Then the DB layer have already committed.
>>
>> So trying to avoid doing work after the DB layer would help.
>>
>>
>> Is this not possible?
>> But he is doing JPA/Hibernte stuff so he could grab the "session" and
>> invoke a rollback manually in case errors happen afterwards.
>>
>>
>>
>>
>> >
>> > On Fri, Jul 3, 2009 at 10:48, Charles Moulliard<cmoulli...@gmail.com>
>> wrote:
>> >> Claus,
>> >>
>> >> I don't want at all to use XA transaction. Correct me if I'm wrong but
>> the
>> >> example of the documentation (Camel 2.0 - JMS Sample - part Spring XML)
>> does
>> >> not use at all a XA driver and the message will not be removed from the
>> >> queue if a rollback occurs in the bean MyProcessor ?
>> >>
>> >> My concern is to avoid to lost messages from a file, queues if something
>> >> happen in one of the services called where by example we have to save
>> data
>> >> in a DB or generate a report for a client. If such errors occur, then we
>> >> have to investigate why can't save data in DB (maybe related to a
>> connection
>> >> issue, DB shutdown, ...) or generates files (maybe due to disk full,
>> access
>> >> right, ....). Sometimes, this is related to conditions out of the
>> control of
>> >> our application but sometimes no, then we have to correct the error and
>> >> install a new version of the code. After the restart of the application
>> and
>> >> recovery of messages (persisted in the case of activemq), messages will
>> be
>> >> reprocessed.
>> >>
>> >> Regards,
>> >>
>> >> Charles Moulliard
>> >> Senior Enterprise Architect
>> >> Apache Camel Committer
>> >>
>> >> *****************************
>> >> blog : http://cmoulliard.blogspot.com
>> >>
>> >>
>> >> On Fri, Jul 3, 2009 at 10:26 AM, Claus Ibsen <claus.ib...@gmail.com>
>> wrote:
>> >>
>> >>> And reconsider if you need XA at all. Its slow and hard to get setup.
>> >>>
>> >>> Try to let the DB be the last stuff you do and afterwards send the
>> >>> message to another queue for further processing in a 2nd route.
>> >>> If that is possible in your use-case.
>> >>>
>> >>>
>> >>> On Fri, Jul 3, 2009 at 10:25 AM, Claus Ibsen<claus.ib...@gmail.com>
>> wrote:
>> >>> > Hi
>> >>> >
>> >>> > Get it working outside OSGi, eg in a small unit test thats easy to
>> run
>> >>> > and test from within your IDE.
>> >>> > Google for JMS + hibernate + TX + XA to find some samples that work.
>> >>> >
>> >>> > And since you use JMS + DB in the same TX you need to use XA db
>> driver.
>> >>> >
>> >>> > It can be a painful to get setup
>> >>> >
>> >>>
>> http://coffeedrivenjava.blogspot.com/2006/08/distributed-xa-transactions-w-hibernate.html
>> >>> >
>> >>> > And you need an XA TX manager such as JOTM
>> >>> > http://jotm.ow2.org/xwiki/bin/view/Main/WebHome
>> >>> >
>> >>> > In j2ee land there was a JTA with the container that could do it. But
>> >>> > in your OSGi container I do not know if it provides one out of the
>> >>> > box.
>> >>> >
>> >>> >
>> >>> > On Fri, Jul 3, 2009 at 10:09 AM, Charles Moulliard<
>> cmoulli...@gmail.com>
>> >>> wrote:
>> >>> >> I'm still fighting against Spring config or Camel because Rollback
>> does
>> >>> not
>> >>> >> occur. I have been able to configure Hibernate to use the same
>> >>> >> TransactionManager as the one used by JMS
>> >>> >>
>> >>> >> Here is the different part of the config. I don't know where the
>> issue
>> >>> could
>> >>> >> be !
>> >>> >>
>> >>> >> 1) ActiveMQ
>> >>> >>
>> >>> >> ...
>> >>> >>
>> >>> >>    <bean id="activemqConnectionFactory"
>> >>> >> class="org.apache.activemq.ActiveMQConnectionFactory">
>> >>> >>        <property name="brokerURL" value="tcp://localhost:61616" />
>> >>> >>    </bean>
>> >>> >>
>> >>> >>    <bean id="pooledConnectionFactory"
>> >>> >> class="org.apache.activemq.pool.PooledConnectionFactoryBean">
>> >>> >>        <property name="maxConnections" value="8" />
>> >>> >>        <property name="maximumActive" value="500" />
>> >>> >>        <property name="transactionManager" ref="transactionManager"
>> />
>> >>> >>        <property name="connectionFactory"
>> >>> ref="activemqConnectionFactory"
>> >>> >> />
>> >>> >>        <property name="resourceName" value="activemq.default" />
>> >>> >>    </bean>
>> >>> >>
>> >>> >>    <bean id="resourceManager"
>> >>> >> class="org.apache.activemq.pool.ActiveMQResourceManager"
>> >>> >> init-method="recoverResource">
>> >>> >>          <property name="transactionManager"
>> ref="transactionManager" />
>> >>> >>          <property name="connectionFactory"
>> >>> ref="activemqConnectionFactory"
>> >>> >> />
>> >>> >>          <property name="resourceName" value="activemq.default" />
>> >>> >>    </bean>
>> >>> >>
>> >>> >>    <osgi:reference id="transactionManager"
>> >>> >> interface="javax.transaction.TransactionManager" /> // This OSGI
>> service
>> >>> is
>> >>> >> published by Geronimo Transaction bundle
>> >>> >>
>> >>> >>    <osgi:service ref="pooledConnectionFactory">
>> >>> >>        <osgi:interfaces>
>> >>> >>            <value>javax.jms.ConnectionFactory</value>
>> >>> >>        </osgi:interfaces>
>> >>> >>        <osgi:service-properties>
>> >>> >>            <entry key="name" value="default"/>
>> >>> >>        </osgi:service-properties>
>> >>> >>    </osgi:service>
>> >>> >>
>> >>> >> 2) Camel ActiveMQComponent
>> >>> >>
>> >>> >>    <bean id="active-mq"
>> >>> >> class="org.apache.activemq.camel.component.ActiveMQComponent">
>> >>> >>        <property name="transacted" value="true"/>
>> >>> >>        <property name="connectionFactory">
>> >>> >>            <osgi:reference interface="javax.jms.ConnectionFactory"/>
>> //
>> >>> >> OSGI service is published by ActiveMQ service
>> >>> >>        </property>
>> >>> >>        <property name="transactionManager">
>> >>> >>            <osgi:reference
>> >>> >>
>> interface="org.springframework.transaction.PlatformTransactionManager"/>
>> >>> >>        </property>
>> >>> >>    </bean>
>> >>> >>
>> >>> >> 2) Hibernate - DAO
>> >>> >>
>> >>> >>    <bean id="sessionFactory"
>> >>> >> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>> >>> >>
>> >>> >>        <property name="mappingLocations">
>> >>> >>            <list>
>> >>> >>
>> >>> >>
>> >>>
>> <value>classpath*:META-INF/com/xpectis/x3s/platform/model/*.hbm.xml</value>
>> >>> >>            </list>
>> >>> >>        </property>
>> >>> >>
>> >>> >>        <property name="hibernateProperties">
>> >>> >>            <props>
>> >>> >>                <prop
>> >>> >> key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
>> >>> >>                <prop key="hibernate.show_sql">true</prop>
>> >>> >>                <prop key="hibernate.format_sql">true</prop>
>> >>> >>                <prop
>> >>> >> key="hibernate.cglib.use_reflection_optimizer">true</prop>
>> >>> >>                <prop key="hibernate.jdbc.batch_size">10</prop>
>> >>> >>                <prop
>> >>> >>
>> >>>
>> key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
>> >>> >>                <prop
>> >>> >>
>> >>>
>> key="hibernate.transaction.factory_class">org.springframework.orm.hibernate3.SpringTransactionFactory</prop>
>> >>> >>            </props>
>> >>> >>        </property>
>> >>> >>        <property name="dataSource">
>> >>> >>            <ref bean="dataSource" />
>> >>> >>        </property>
>> >>> >>
>> >>> >> Remark : To avoid the JNDI lookup issue, we use
>> springTransactionFactory
>> >>> as
>> >>> >> the TransactionFactory for Hibernate (
>> >>> >> http://forum.springsource.org/showthread.php?p=215720)
>> >>> >>
>> >>> >> 3) Service layer
>> >>> >>
>> >>> >> Here is the definition of the service used from Camel route :
>> >>> >>
>> >>> >>    <bean id="notificationServiceTarget"
>> >>> >>
>> class="com.xpectis.x3s.platform.service.impl.NotificationServiceImpl">
>> >>> >>            <property name="notificationDAO">
>> >>> >>            <osgi:reference
>> >>> >> interface="com.xpectis.x3s.platform.dao.NotificationDAO"/>
>> >>> >>        </property>
>> >>> >>
>> >>> >>    </bean>
>> >>> >>
>> >>> >>   <!-- Abstract service using the Geronimo Transaction Manager -->
>> >>> >>    <bean id="abstractService" abstract="true"
>> >>> >>
>> >>>
>> class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
>> >>> >>         <property name="transactionManager">
>> >>> >>            <osgi:reference
>> >>> >>
>> interface="org.springframework.transaction.PlatformTransactionManager"/>
>> >>> >>        </property>
>> >>> >>    </bean>
>> >>> >>
>> >>> >>    <bean id="notificationService"
>> >>> >>          parent="abstractService"
>> >>> >>
>> >>> >>
>> >>>
>> class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
>> >>> >>
>> >>> >>        <property name="target">
>> >>> >>            <ref bean="notificationServiceTarget" />
>> >>> >>        </property>
>> >>> >>
>> >>> >>        <property name="transactionAttributes">
>> >>> >>            <props>
>> >>> >>                <prop key="*">PROPAGATION_REQUIRED</prop>
>> >>> >>            </props>
>> >>> >>        </property>
>> >>> >>    </bean>
>> >>> >>
>> >>> >> 4) Route
>> >>> >>
>> >>> >>    <bean id="myPolicy"
>> >>> class="org.apache.camel.processor.RedeliveryPolicy">
>> >>> >>        <property name="maximumRedeliveries" value="1"/>
>> >>> >>    </bean>
>> >>> >>
>> >>> >>    <bean id="txErrorHandler"
>> >>> >> class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
>> >>> >>        <property name="springTransactionPolicy"
>> >>> >> ref="PROPAGATION_REQUIRED"/>
>> >>> >>        <property name="redeliveryPolicy" ref="myPolicy"/>
>> >>> >>    </bean>
>> >>> >>
>> >>> >>    <bean id="PROPAGATION_REQUIRED"
>> >>> >> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>> >>> >>        <property name="transactionManager">
>> >>> >>            <osgi:reference
>> >>> >>
>> interface="org.springframework.transaction.PlatformTransactionManager"/>
>> >>> >>        </property>
>> >>> >>    </bean>
>> >>> >>
>> >>> >>        <camel:route errorHandlerRef="txErrorHandler">
>> >>> >>            <camel:from ref="queueQuickFixInEndpoint" />
>> >>> >>            <camel:convertBodyTo type="quickfix.Message" />
>> >>> >>            <camel:transacted ref="PROPAGATION_REQUIRED"/>
>> >>> >>            <camel:bean ref="serviceHelper"
>> method="createNotification"
>> >>> />
>> >>> >>            <camel:bean ref="serviceHelper" method="generateError" />
>> >>> >>            <camel:to ref="directNotificationEndpoint" />
>> >>> >>        </camel:route>
>> >>> >>
>> >>> >> Any ideas are welcome
>> >>> >>
>> >>> >> Regards,
>> >>> >>
>> >>> >> Charles Moulliard
>> >>> >> Senior Enterprise Architect
>> >>> >> Apache Camel Committer
>> >>> >>
>> >>> >> *****************************
>> >>> >> blog : http://cmoulliard.blogspot.com
>> >>> >>
>> >>> >>
>> >>> >> On Thu, Jul 2, 2009 at 5:02 PM, Charles Moulliard <
>> cmoulli...@gmail.com
>> >>> >wrote:
>> >>> >>
>> >>> >>> OK. I will try to create my own Hibernate JTATransaction manager as
>> the
>> >>> >>> existing try to perform a JNDI lookup to find the transaction
>> manager
>> >>> on
>> >>> >>> OSGI platform (inheritage from J2EE world)
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>>
>> http://mail-archives.apache.org/mod_mbox/servicemix-dev/200904.mbox/%3cb23ecedc0904020615y55df4d0fhb303a2ea22df7...@mail.gmail.com%3e
>> >>> >>>
>> >>> >>>
>> >>> >>> Charles Moulliard
>> >>> >>> Senior Enterprise Architect
>> >>> >>> Apache Camel Committer
>> >>> >>>
>> >>> >>> *****************************
>> >>> >>> blog : http://cmoulliard.blogspot.com
>> >>> >>>
>> >>> >>>
>> >>> >>> On Thu, Jul 2, 2009 at 4:56 PM, Claus Ibsen <claus.ib...@gmail.com
>> >
>> >>> wrote:
>> >>> >>>
>> >>> >>>> On Thu, Jul 2, 2009 at 4:53 PM, Charles Moulliard<
>> >>> cmoulli...@gmail.com>
>> >>> >>>> wrote:
>> >>> >>>> > queueQuickFixInEndpoint is a JMS queue.
>> >>> >>>> >
>> >>> >>>> > I will add the ref to the transacted and retest
>> >>> >>>> >
>> >>> >>>> > Question : I suppose that rollback will not occur if by example
>> JMS
>> >>> and
>> >>> >>>> DB
>> >>> >>>> > (=Hibernate) does not use the same TransactionManager and don't
>> use
>> >>> this
>> >>> >>>> > spring class together :
>> >>> >>>> > org.springframework.transaction.PlatformTransactionManager
>> >>> >>>> Yes they must be configured to use the same TX manager.
>> >>> >>>>
>> >>> >>>>
>> >>> >>>> >
>> >>> >>>> > Regards,
>> >>> >>>> >
>> >>> >>>> > Charles Moulliard
>> >>> >>>> > Senior Enterprise Architect
>> >>> >>>> > Apache Camel Committer
>> >>> >>>> >
>> >>> >>>> > *****************************
>> >>> >>>> > blog : http://cmoulliard.blogspot.com
>> >>> >>>> >
>> >>> >>>> >
>> >>> >>>> > On Thu, Jul 2, 2009 at 4:46 PM, Claus Ibsen <
>> claus.ib...@gmail.com>
>> >>> >>>> wrote:
>> >>> >>>> >
>> >>> >>>> >> Transacted also have a ref attribute
>> >>> >>>> >>
>> >>> >>>> >> <transacted ref="required"/>
>> >>> >>>> >>
>> >>> >>>> >> Is queueQuickFixInEndpoint a JMS queue?
>> >>> >>>> >> You need to use a TX manager that can do both JMS and DB.
>> >>> >>>> >>
>> >>> >>>> >>
>> >>> >>>> >>
>> >>> >>>> >> On Thu, Jul 2, 2009 at 4:31 PM, Charles Moulliard<
>> >>> cmoulli...@gmail.com
>> >>> >>>> >
>> >>> >>>> >> wrote:
>> >>> >>>> >> > I have been able to solve my problem by adding the following
>> bean
>> >>> >>>> >> definition
>> >>> >>>> >> > :
>> >>> >>>> >> >
>> >>> >>>> >> >    <bean id="required"
>> >>> >>>> >> > class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>> >>> >>>> >> >        <property name="transactionManager">
>> >>> >>>> >> >            <osgi:reference
>> >>> >>>> >> >
>> >>> >>>>
>> >>>
>> interface="org.springframework.transaction.PlatformTransactionManager"/>
>> >>> >>>> >> >        </property>
>> >>> >>>> >> >    </bean>
>> >>> >>>> >> >
>> >>> >>>> >> > and in the route
>> >>> >>>> >> >
>> >>> >>>> >> >        <camel:route>
>> >>> >>>> >> >            <camel:from ref="queueQuickFixInEndpoint" />
>> >>> >>>> >> >            <camel:convertBodyTo type="quickfix.Message" />
>> >>> >>>> >> >            <camel:transacted/>
>> >>> >>>> >> >            <camel:policy ref="required" />
>> >>> >>>> >> >            <camel:bean ref="serviceHelper"
>> >>> >>>> method="createNotification" />
>> >>> >>>> >> >            <camel:bean ref="serviceHelper"
>> method="generateError"
>> >>> />
>> >>> >>>> >> >            <camel:to ref="directNotificationEndpoint" />
>> >>> >>>> >> >        </camel:route>
>> >>> >>>> >> >
>> >>> >>>> >> > Unfortunately, the rollback does not occur in the DB and 6
>> >>> records
>> >>> >>>> have
>> >>> >>>> >> been
>> >>> >>>> >> > created by the method createNotification when error has been
>> >>> raised
>> >>> >>>> by
>> >>> >>>> >> the
>> >>> >>>> >> > method generateError.
>> >>> >>>> >> >
>> >>> >>>> >> > What is missing ?
>> >>> >>>> >> >
>> >>> >>>> >> > Charles Moulliard
>> >>> >>>> >> > Senior Enterprise Architect
>> >>> >>>> >> > Apache Camel Committer
>> >>> >>>> >> >
>> >>> >>>> >> > *****************************
>> >>> >>>> >> > blog : http://cmoulliard.blogspot.com
>> >>> >>>> >> >
>> >>> >>>> >> >
>> >>> >>>> >> > On Thu, Jul 2, 2009 at 4:19 PM, Charles Moulliard <
>> >>> >>>> cmoulli...@gmail.com
>> >>> >>>> >> >wrote:
>> >>> >>>> >> >
>> >>> >>>> >> >> When I compare the example :
>> >>> JMSTransactionalClientRollbackTest.xml
>> >>> >>>> >> >>
>> >>> >>>> >> >>     <!-- START SNIPPET: e1 -->
>> >>> >>>> >> >>     <!-- setup JMS connection factory -->
>> >>> >>>> >> >>     <bean id="jmsConnectionFactory"
>> >>> >>>> >> >> class="org.apache.activemq.ActiveMQConnectionFactory">
>> >>> >>>> >> >>         <property name="brokerURL"
>> >>> >>>> >> >>
>> >>> >>>>
>> >>>
>> value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
>> >>> >>>> >> >>     </bean>
>> >>> >>>> >> >>
>> >>> >>>> >> >>     <!-- setup spring jms TX manager -->
>> >>> >>>> >> >>     <bean id="jmsTransactionManager"
>> >>> >>>> >> >>
>> >>> class="org.springframework.jms.connection.JmsTransactionManager">
>> >>> >>>> >> >>         <property name="connectionFactory"
>> >>> >>>> ref="jmsConnectionFactory"/>
>> >>> >>>> >> >>     </bean>
>> >>> >>>> >> >>
>> >>> >>>> >> >>     <!-- define our activemq component -->
>> >>> >>>> >> >>     <bean id="activemq"
>> >>> >>>> >> >>
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>> >>> >>>> >> >>         <property name="connectionFactory"
>> >>> >>>> ref="jmsConnectionFactory"/>
>> >>> >>>> >> >>         <!-- define the jms consumer/producer as transacted
>> -->
>> >>> >>>> >> >>         <property name="transacted" value="true"/>
>> >>> >>>> >> >>         <!-- setup the transaction manager to use -->
>> >>> >>>> >> >>         <!-- if not provided then Camel will automatic use a
>> >>> >>>> >> >> JmsTransactionManager, however if you
>> >>> >>>> >> >>              for instance use a JTA transaction manager then
>> you
>> >>> >>>> must
>> >>> >>>> >> >> configure it -->
>> >>> >>>> >> >>         <property name="transactionManager"
>> >>> >>>> >> ref="jmsTransactionManager"/>
>> >>> >>>> >> >>     </bean>
>> >>> >>>> >> >>     <!-- END SNIPPET: e1 -->
>> >>> >>>> >> >>
>> >>> >>>> >> >>     <!-- START SNIPPET: e2 -->
>> >>> >>>> >> >>     <camelContext xmlns="
>> http://camel.apache.org/schema/spring
>> >>> ">
>> >>> >>>> >> >>         <route>
>> >>> >>>> >> >>             <!-- 1: from the jms queue -->
>> >>> >>>> >> >>             <from uri="activemq:queue:okay"/>
>> >>> >>>> >> >>             <!-- 2: mark this route as transacted -->
>> >>> >>>> >> >>             <transacted/>
>> >>> >>>> >> >>             <!-- 3: call our business logic that is
>> myProcessor
>> >>> -->
>> >>> >>>> >> >>             <process ref="myProcessor"/>
>> >>> >>>> >> >>             <!-- 4: if success then send it to the mock -->
>> >>> >>>> >> >>             <to uri="mock:result"/>
>> >>> >>>> >> >>         </route>
>> >>> >>>> >> >>     </camelContext>
>> >>> >>>> >> >>
>> >>> >>>> >> >> with mine.
>> >>> >>>> >> >>
>> >>> >>>> >> >> What is different concerns the TransactionManager used.
>> >>> >>>> >> >>
>> >>> >>>> >> >> In the example, this is the Spring one:
>> >>> >>>> >> >>
>> >>> >>>> >> >>     <!-- setup spring jms TX manager -->
>> >>> >>>> >> >>     <bean id="jmsTransactionManager"
>> >>> >>>> >> >>
>> >>> class="org.springframework.jms.connection.JmsTransactionManager">
>> >>> >>>> >> >>         <property name="connectionFactory"
>> >>> >>>> ref="jmsConnectionFactory"/>
>> >>> >>>> >> >>     </bean>
>> >>> >>>> >> >>
>> >>> >>>> >> >> and in my case, ActiveMQ is configured to use Geronimo
>> >>> Transaction
>> >>> >>>> >> Manager
>> >>> >>>> >> >> bundle (which in fact uses spring Transaction manager :
>> >>> >>>> >> >> org.springframework.transaction.jta.JtaTransactionManager;)
>> >>> >>>> >> >>
>> >>> >>>> >> >> I suppose that in the example, the policy is defined by
>> default
>> >>> by
>> >>> >>>> >> spring
>> >>> >>>> >> >> when instantiating the class :
>> >>> >>>> >> >> org.springframework.jms.connection.JmsTransactionManager
>> >>> >>>> >> >>
>> >>> >>>> >> >> Is it possible to do the same using a JtaTransaction manager
>> ?
>> >>> >>>> >> >>
>> >>> >>>> >> >> Regards,
>> >>> >>>> >> >>
>> >>> >>>> >> >> Charles Moulliard
>> >>> >>>> >> >> Senior Enterprise Architect
>> >>> >>>> >> >> Apache Camel Committer
>> >>> >>>> >> >>
>> >>> >>>> >> >> *****************************
>> >>> >>>> >> >> blog : http://cmoulliard.blogspot.com
>> >>> >>>> >> >>
>> >>> >>>> >> >>
>> >>> >>>> >> >> On Thu, Jul 2, 2009 at 3:57 PM, Claus Ibsen <
>> >>> claus.ib...@gmail.com>
>> >>> >>>> >> wrote:
>> >>> >>>> >> >>
>> >>> >>>> >> >>> Hi
>> >>> >>>> >> >>>
>> >>> >>>> >> >>> Yeah you need to add all the spring transaction stuff.
>> >>> >>>> >> >>>
>> >>> >>>> >> >>>
>> >>> >>>> >> >>> On Thu, Jul 2, 2009 at 3:47 PM, Charles Moulliard<
>> >>> >>>> cmoulli...@gmail.com
>> >>> >>>> >> >
>> >>> >>>> >> >>> wrote:
>> >>> >>>> >> >>> > Camel generates the following error with my route :
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>> > Route
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>> >        <camel:route>
>> >>> >>>> >> >>> >            <camel:from ref="queueQuickFixInEndpoint" />
>> >>> >>>> >> >>> >            <camel:convertBodyTo type="quickfix.Message"
>> />
>> >>> >>>> >> >>> >            <camel:transacted/>
>> >>> >>>> >> >>> >            <camel:bean ref="serviceHelper"
>> >>> >>>> >> method="createNotification"
>> >>> >>>> >> >>> />
>> >>> >>>> >> >>> >            <camel:bean ref="serviceHelper"
>> >>> method="generateError"
>> >>> >>>> />
>> >>> >>>> >> >>> >            <camel:to ref="directNotificationEndpoint" />
>> >>> >>>> >> >>> >        </camel:route>
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>> > It seems that policy must be defined but in the example
>> here
>> >>> it
>> >>> >>>> is
>> >>> >>>> >> not
>> >>> >>>> >> >>> > mentioned :
>> >>> http://camel.apache.org/transactional-client.html
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>> > Error :
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>> > 15:43:07,838 | ERROR | xtenderThread-30 |
>> >>> ContextLoaderListener
>> >>> >>>> >> >>>    |
>> >>> >>>> >> >>> > BundleApplicationContextListener   50 | Application
>> context
>> >>> >>>> refresh
>> >>> >>>> >> >>> failed
>> >>> >>>> >> >>> >
>> >>> (OsgiBundleXmlApplicationContext(bundle=com.xpectis.x3s.x3s-core,
>> >>> >>>> >> >>> > config=osgibundle:/META-INF/spring/*.xml))
>> >>> >>>> >> >>> > org.apache.camel.RuntimeCamelException:
>> >>> >>>> >> >>> java.lang.IllegalArgumentException:
>> >>> >>>> >> >>> > policy must be specified on: Transacted[ref: null]
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:986)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:465)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
>> >>> >>>> >> >>> >    at java.lang.Thread.run(Thread.java:619)
>> >>> >>>> >> >>> > Caused by: java.lang.IllegalArgumentException: policy
>> must be
>> >>> >>>> >> specified
>> >>> >>>> >> >>> on:
>> >>> >>>> >> >>> > Transacted[ref: null]
>> >>> >>>> >> >>> >    at
>> >>> >>>> >>
>> org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:258)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.model.TransactedDefinition.createProcessor(TransactedDefinition.java:129)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:226)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:111)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:294)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:120)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:552)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:969)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:946)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >>
>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:863)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:99)
>> >>> >>>> >> >>> >    at
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >>
>> >>> >>>>
>> >>>
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:119)
>> >>> >>>> >> >>> > Charles Moulliard
>> >>> >>>> >> >>> > Senior Enterprise Architect
>> >>> >>>> >> >>> > Apache Camel Committer
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>> > *****************************
>> >>> >>>> >> >>> > blog : http://cmoulliard.blogspot.com
>> >>> >>>> >> >>> >
>> >>> >>>> >> >>>
>> >>> >>>> >> >>>
>> >>> >>>> >> >>>
>> >>> >>>> >> >>> --
>> >>> >>>> >> >>> Claus Ibsen
>> >>> >>>> >> >>> Apache Camel Committer
>> >>> >>>> >> >>>
>> >>> >>>> >> >>> Open Source Integration: http://fusesource.com
>> >>> >>>> >> >>> Blog: http://davsclaus.blogspot.com/
>> >>> >>>> >> >>> Twitter: http://twitter.com/davsclaus
>> >>> >>>> >> >>>
>> >>> >>>> >> >>
>> >>> >>>> >> >>
>> >>> >>>> >> >
>> >>> >>>> >>
>> >>> >>>> >>
>> >>> >>>> >>
>> >>> >>>> >> --
>> >>> >>>> >> Claus Ibsen
>> >>> >>>> >> Apache Camel Committer
>> >>> >>>> >>
>> >>> >>>> >> Open Source Integration: http://fusesource.com
>> >>> >>>> >> Blog: http://davsclaus.blogspot.com/
>> >>> >>>> >> Twitter: http://twitter.com/davsclaus
>> >>> >>>> >>
>> >>> >>>> >
>> >>> >>>>
>> >>> >>>>
>> >>> >>>>
>> >>> >>>> --
>> >>> >>>> Claus Ibsen
>> >>> >>>> Apache Camel Committer
>> >>> >>>>
>> >>> >>>> Open Source Integration: http://fusesource.com
>> >>> >>>> Blog: http://davsclaus.blogspot.com/
>> >>> >>>> Twitter: http://twitter.com/davsclaus
>> >>> >>>>
>> >>> >>>
>> >>> >>>
>> >>> >>
>> >>> >
>> >>> >
>> >>> >
>> >>> > --
>> >>> > Claus Ibsen
>> >>> > Apache Camel Committer
>> >>> >
>> >>> > Open Source Integration: http://fusesource.com
>> >>> > Blog: http://davsclaus.blogspot.com/
>> >>> > Twitter: http://twitter.com/davsclaus
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Claus Ibsen
>> >>> Apache Camel Committer
>> >>>
>> >>> Open Source Integration: http://fusesource.com
>> >>> Blog: http://davsclaus.blogspot.com/
>> >>> Twitter: http://twitter.com/davsclaus
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> > ------------------------
>> > Open Source SOA
>> > http://fusesource.com
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to