Please use the users@ mailing list for such kind of questions as we
mentioned at [1].

If you use a transacted route, Camel will use a transactional error handler
which delegated to the transaction manager. The transaction manager will
commit/rollback the transaction and leverage on the broker how it deals
with messages which are rolled back multiple times. ActiveMQ will move
these messages into a special queue which is called "ActiveMQ.DLQ".
The a
May be the example at [2] is useful for you.

[1] http://camel.apache.org/mailing-lists.html
[2]
https://github.com/muellerc/camel-in-transaction/blob/master/src/test/java/org/apache/cmueller/camel/samples/camelone/jms/JmsTransactionSampleTest.java

Best,
Christian

On Mon, Dec 31, 2012 at 2:19 PM, MichaelS <[email protected]>wrote:

> Hi,
>
> I am trying to send the same message to multiple endpoints in one
> transaction. That means i what the transaction to rollback if any error is
> encountered and one of the endpoints doesn't receive the message, resulting
> in the fact that the message is sent to the deadLetterQueue and in the fact
> that none of the endpoints actually receive the message.
>
> I use validateMessageProcessor to simulate an exception.
> My route is:
>    errorHandler(deadLetterChannel("activemq:dead"));
>         onException(Exception.class)
>                 .maximumRedeliveries(0)
>                 .handled(true);
>
>         from("activemq:jms/RoutingQueue")
>                 .transacted("PROPAGATION_REQUIRED")
>                 .to("activemq:jms/MihaiQueue")
>                 .to("activemq:jmsActive")
>                                 .process(validateMessageProcessor)
>                 .to("activemq:a");
>
> The context is:
>     <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>         <property name="transacted" value="true"/>
>         <property name="transactionManager" ref="transactionManager"/>
>     </bean>
>
>     <bean id="transactionManager"
> class="org.springframework.jms.connection.JmsTransactionManager">
>         <property name="connectionFactory"
> ref="activeMQConnectionFactory"/>
>     </bean>
>
>     <bean id="activeMQConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>         <property name="brokerURL" value="tcp://TEST:61616"/>
>         <property name="redeliveryPolicy">
>             <bean class="org.apache.activemq.RedeliveryPolicy">
>                 <property name="maximumRedeliveries" value="0"/>
>             </bean>
>         </property>
>     </bean>
>
>     <bean id="PROPAGATION_REQUIRED"
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>         <property name="transactionManager" ref="transactionManager"/>
>         <property name="propagationBehaviorName"
> value="PROPAGATION_REQUIRED"/>
>     </bean>
>
> My problem is the fact that the message still arrives in jms/MihaiQueue and
> jmsActive, even though it arrives in deadLetterQueue too.
> Since sending to "a" has failed i want the messages from jms/MihaiQueue and
> jmsActive to be rolled back.
>
> Do you have any suggestions as to what i am doing wrong?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-send-a-message-to-multiple-endpoints-in-one-transaction-tp5724749.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>



--

Reply via email to