On Mon, Oct 19, 2009 at 8:44 PM, Allen Lau <[email protected]> wrote:
> Hi Claus,  I think having Camel decorate the message is a great idea.   We
> are having the same issue where when a message goes to the DLQ.   For
> components/endpoints we create ourselves, we usually try to add such a
> header, but for existing Camel components, this information would be very
> helpful.
>

I have created ticket to track this
https://issues.apache.org/activemq/browse/CAMEL-2079

> Thanks,
> Allen
>
> On Mon, Oct 19, 2009 at 6:05 AM, Claus Ibsen <[email protected]> wrote:
>
>> On Tue, Oct 13, 2009 at 10:36 PM, terminator_007
>> <[email protected]> wrote:
>> >
>> > hey,
>> > thanks for the suggestion but I coudnt understand it...
>> >
>> > can you please elaborate a little...
>> >
>>
>> Ah found your reply.
>>
>> In your route you have several endpoints that you send a message to.
>> And in any case of an error you let the dead letter channel handle
>> this error.
>> Your problem is then you want to know if it was endpoint A, endpoint B
>> or endpoint ... N that failed?
>>
>> What we could do is to let Camel decorate the message with a
>> header/property that tells which endpoint was last invoked.
>> Then it makes it super easy for you to know which endpoints failed.
>>
>> Does it make sense now?
>>
>>
>> > thanks a ton.
>> >
>> >
>> > Claus Ibsen-2 wrote:
>> >>
>> >> Hi
>> >>
>> >> Maybe we should let Camel add the endpoint a producer is sending to.
>> >>
>> >> Then when you route using .to("xxx") then Camel will add a header such
>> as
>> >> Exchange.SENDTO_ENDPOINT
>> >>
>> >> Which contains the XXX
>> >>
>> >> That would allow you to easily know which service failed.
>> >>
>> >>
>> >>
>> >>
>> >> On Sun, Oct 11, 2009 at 1:39 AM, tide08 <[email protected]> wrote:
>> >>>
>> >>> I would assume that uri would be available in header as per Camel-Http
>> >>> Documentation:
>> >>>
>> >>> HttpProducer.HTTP_URI - for v1.6.x
>> >>> Exchange.HTTP_URI - for v2.x
>> >>>
>> >>> or else as other approach you can just set header to distinguish
>> between
>> >>> uri's avoiding custom processor for errorHandler itself.
>> >>>
>> >>> Something like -
>> >>>
>> >>> <to uri="bean:soapMessageCreator"/>
>> >>>                        <multicast>
>> >>> <pipeline>
>> >>> <setHeader headerName="serviceName">
>> >>>        <constant>serviceone</constant>
>> >>>    </setHeader>
>> >>>
>> >>>                        <to
>> >>> uri="http://mpkl04l34h9g2:8080/serviceone/subscriber"/>
>> >>> </pipeline>
>> >>> <pipeline>
>> >>> <setHeader headerName="serviceName">
>> >>>        <constant>servicetwo</constant>
>> >>>    </setHeader>
>> >>>
>> >>>                        <to
>> >>> uri="http://mpkl04l34h9g2:8080/servicetwo/subscriber"/>
>> >>> </pipeline>
>> >>>                        </multicast>
>> >>>
>> >>> All the best!
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> terminator_007 wrote:
>> >>>>
>> >>>> thanks for the suggestion..i have one doubt here..how do i get the
>> know
>> >>>> in
>> >>>> the processor class which delivery has failed...i am delivering to two
>> >>>> destinations...so is there any property on the xchange message which
>> >>>> will
>> >>>> tell me the delivery to which destination has failed ?
>> >>>>
>> >>>> tide08 wrote:
>> >>>>>
>> >>>>> 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&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-tp25827098p25838615.html
>> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> Apache Camel Committer
>> >>
>> >> Open Source Integration: http://fusesource.com
>> >> Blog: http://davsclaus.blogspot.com/
>> >> Twitter: http://twitter.com/davsclaus
>> >>
>> >>
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/modify-message-before-delivering-to-Dead-Letter-Queue-tp25827098p25880385.html
>> > Sent from the Camel - Users mailing list archive at Nabble.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

Reply via email to