camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tide08 <sachin2...@yahoo.com>
Subject Re: modify message before delivering to Dead Letter Queue
Date Fri, 09 Oct 2009 22:35:25 GMT

You can register a processor which is invoked before message to DLQ. This can
be achieved by property onRedelivery on DeadLetterChannelBuilder. So
following should work -

<bean id="myDeadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
           <property name="onRedelivery" ref="myErrorProcessor"/>
           <property name="deadLetterUri"
value="activemq:queue:queue.DeadLetter"/>
	       <property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig"/>
		   <property name="useOriginalMessage" value="true"/>
		   
	        <property name="handled" value="false"/>
	 </bean>  

<bean id="myErrorProcessor" class="com.app.CustomErrorProcessor" />

You can than manipulate message header before it goes to DLQ.

Thanks!


terminator_007 wrote:
> 
> This is my configuration file
> 
> 	<bean id="soapMessageCreator" class="XXX.SOAPMessageCreator"/>
> 	 
> 	 <bean id="myDeadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
>            <property name="deadLetterUri"
> value="activemq:queue:queue.DeadLetter"/>
> 	       <property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig"/>
> 		   <property name="useOriginalMessage" value="true"/>
> 		   
> 	        <property name="handled" value="false"/>
> 	 </bean>   
>      <bean id="myRedeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
>            <property name="maximumRedeliveries" value="4"/>
> 	       <property name="redeliverDelay" value="250"/>
>      </bean>
> 
>    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
> >
>         <package>org.apache.camel.example.jmstofile</package>        
>          <route errorHandlerRef="myDeadLetterErrorHandler">
> 			<from
> uri="activemq:topic:topic.Patient?clientId=testCamelClient&amp;durableSubscriptionName=zyz123"/>
>            	<to uri="bean:soapMessageCreator"/>
> 			<multicast>
> 			<to uri="http://mpkl04l34h9g2:8080/serviceone/subscriber"/>
> 			<to uri="http://mpkl04l34h9g2:8080/servicetwo/subscriber"/>
> 			</multicast>
> 
>         </route>
>    </camelContext>
> 
> <bean id="http" class="org.apache.camel.component.http.HttpComponent">
>     <property name="camelContext" ref="camel"/>
>     <property name="httpConnectionManager" ref="myHttpConnectionManager"/>
> </bean>
> 
> <bean id="myHttpConnectionManager"
> class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
>     <property name="params" ref="myHttpConnectionManagerParams"/>
> </bean>
> 
> <bean id="myHttpConnectionManagerParams"
> class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
>     <property name="defaultMaxConnectionsPerHost" value="5"/>
> </bean>
> 
> 
> here, if one of my "to" destination is down, I see two messages in the
> DLQ. 
> also, i want to modify the message header with the name of the destination
> that failed for example if service
> "http://mpkl04l34h9g2:8080/servicetwo/subscriber" was down, I want  to add
> "http://mpkl04l34h9g2:8080/servicetwo/subscriber" to
> messager/header/target before delivering the message to DLQ so that the
> admin process which checks messages in DLQ knows which are the targets
> which did not receive the message.
> 
> Please suggest what can be done to achieve this.
> 

-- 
View this message in context: http://www.nabble.com/modify-message-before-delivering-to-Dead-Letter-Queue-tp25827098p25828904.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message