Hello,

I have a message driven bean deployed in a Websphere 8.0 server that is 
consuming messages from a Websphere MQ message broker. I would like to replace 
the MDB by a Camel JMS component but I have some issues regarding the proper 
handling of message rollback and XA transactions. The message processing does 
database updates. If an exception occurs during this database update (or any 
other runtime exception occurs) then the database updates and the message 
reception need to be rollbacked (placing the message back on the qeue). Up to 
three redeliveries occur after which the WAS message listener puts the message 
in a backout queue. This setup is currently working.
I tried to mimick this behaviour with Camel but have been unsuccessfull until 
now.

What I see is that Camel itself retries 3 times (without putting back the 
message onto the queue). Only after doing three retries, Camel rollbacks the 
transaction and the message is put back on the queue after which it is again 
redelivered from the queue.

What I would like however is that Camel itself doesn't do a retry but 
immediately rollbacks the message to the queue if an exception occurs. If Camel 
notices that three redeliveries from the queue have been done (this can be 
checked via a custom JMS header property that is set by MQ and that indicates 
the number of redeliveries) then the message has to be placed on a backout 
queue by Camel.

I already looked around but until now I have no idea how I can implement this 
use case.

Below you can find my Camel config file. I am using Camel 2.10.1.

Any help would be greatly appreciated.

kind regards,

Frederik.


        <bean id="required" 
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
                <property name="transactionManager" ref="transactionManager" />
                <property name="propagationBehaviorName" 
value="PROPAGATION_REQUIRED" />
        </bean>

        <camel:camelContext xmlns="http://camel.apache.org/schema/spring"; 
id="camelContext">
                <endpoint id="async.internal.inbound.endpoint" 
uri="jms:queue:GEPQ.QL.IN_PRINT_CONFIRM.0001?exchangePattern=InOnly" />
                <camel:route>
                        <camel:from uri="ref:async.internal.inbound.endpoint" />
                        <camel:transacted ref="required" />
                        <camel:process ref="asyncInternalEndpointImpl" />
                        <camel:onException >
                                
<camel:exception>java.lang.Throwable</camel:exception>
                                <camel:redeliveryPolicy redeliveryDelay="5000" 
maximumRedeliveries="3"></camel:redeliveryPolicy>
                                <camel:handled>
                                        <constant>false</constant>
                                </camel:handled>
                                <camel:to 
uri="jms:queue:GEPQ.QL.IN_PRINT_CONFIRM_BO.0001" />
                                <camel:rollback markRollbackOnly="true" />
                        </camel:onException>

                </camel:route>

        </camel:camelContext>

        <bean id="jmsConfig" 
class="org.apache.camel.component.jms.JmsConfiguration">
                <property name="connectionFactory" ref="geosConnectionFactory" 
/>
                <property name="concurrentConsumers" value="1" />
                <property name="maxConcurrentConsumers" value="10" />
                <property name="cacheLevelName" value="CACHE_NONE" />
                <!--<property name="transacted" value="false" />-->
                <property name="transactionManager" ref="transactionManager" />
                <property name="taskExecutor" ref="wasTaskExecutor" />
                <property name="disableReplyTo" value="true" />
                <property name="errorHandlerLoggingLevel" value="DEBUG" />
        </bean>

Frederik De Backer

Belfius
ITDEV/DCAR/DART

* DT 16 / 37
* 02/22 25252
* mailto:frederik.debac...@belfius.be  | www.belfius.be



-----------------------------------------------------------------------------

http://www.belfius.be/maildisclaimer.htm

-----------------------------------------------------------------------------

Reply via email to