Even by removing the exchange.setOut I am not seeing the header I've added
when checking the exchange In message on the exception processor.

this is my current process for interceptSendToEndpoint:
public void process(Exchange exchange) throws Exception {               
 String deliveryEndPoint =
exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();           
                
 Message camel_reply = exchange.getIn();                
 camel_reply.setHeader("current-endpoint", deliveryEndPoint);           
}


I did a small test by changing the body on each intercept process and when
the exception is thrown I
see the original body of the message and not the one I've changed, it looks
like I am looking into the wrong thing in the exception processor:

public void process(Exchange exchange) throws Exception {
        Throwable caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Throwable.class);
       
        Message inMsg = exchange.getIn();
        //inMsg body is the original one and not the one that has been
modified by the interceptor.
        
}





Claus Ibsen-2 wrote:
> 
> On Wed, Nov 4, 2009 at 5:12 PM, mcrive <mcr...@optasportsdata.com> wrote:
>>
>> I've configured following route:
>>
>> interceptSendToEndpoint("*").process(new SendToEndPointHandler());
>>
>> onException(GenericFileOperationFailedException.class)
>>        .process(new DeliveryFailureHandler());
>>
>> from("test-jms:queue:notificationtest.queue")
>>        .process(processor)
>>        .recipientList(header("recipientListHeader").tokenize(","));
>>
>>
>> SendToEndPointHandler does following on process method:
>> String deliveryEndPoint =
>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
>> Message camel_reply = exchange.getIn();
>> camel_reply.setHeader("current-endpoint", deliveryEndPoint);
> 
> 
> Remove this one line below as you do not want to change the exchange
> pattern. All you wanted to do was to add that 1 extra header on the IN
> message.
> 
> 
>> exchange.setOut(camel_reply);
>>
>>
>> unfortunately on DeliveryFailureHandler I am not seeing the new injected
>> header...
>> what am I missing?
>>
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> You can use interceptSendToEndpoint
>>> http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-interceptors-round.html
>>> And see more details at the Camel documentation (link from above)
>>>
>>>
>>> And then have it decorate with a custom header what the endpoint is.
>>> That you can retrieve in your error processor.
>>>
>>> The intercepted endpoint is stored in the IN message header as:
>>> Exchange.INTERCEPTED_ENDPOINT
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26199328.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26200307.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to