首页 > 解决方案 > How to send the original message to DLQ after processing

问题描述

How can I customize the route so that the original message appears in dlq? Now if my server is unavailable, messages appear in dlq after processing, for example: the message with body “origin_message” is in the my_test queue, after processing in myProcess I change it to “new_message”, and if the server is unavailable or answered with codes 400+ 500+ , in my queue my_dlq there is a message with the body "new_message"

<bean id="myDeadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
        <property name="deadLetterUri" value="activemq://my_dlq"/>
</bean>

<bean id="myProcess" class="mapper.MyProcess" />    

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">

      <route errorHandlerRef="myDeadLetterErrorHandler">
        <from uri="activemq://my_test"/>
        <process ref="myProcess" />
        <to uri="http://localhost:3000"/>
      </route>

    </camelContext>

标签: apache-camelactivemqapache-servicemixeip

解决方案


您可以useOriginalMessage=true在错误处理程序上配置。


推荐阅读