Sorry Claus...

I see that we cannot do:

from("jms:delivery-queue).recipientList().header(Constants.ROUTE_HEADER).to(myProcoessor));

I cannot use to on recipientList() or header(name)


Also I cannot do
errorHandler(deadLetterChannel(myProcessor).maximumRedeliveries(0);

deadLetterChannel accepts String definition of Endpoint or Endpoint object.
It does not accept a Processor. But I think that is fine - I can route it to
a dead letter queue and have a queue listener process the updates. Or even
write another route like:
from("jms:temp-dead-letter-queue").process(myProcessor).to("jms:dead-letter-queue");

Any other idea? What do you think?
Hari Gangadharan


Claus Ibsen wrote:
> 
> Hi
> 
> Camel will by default use DeadLetterChannel to handle failed exchanges
> where it will retry 6 times. So after 6 attempts and still a failure it
> will log it as ERROR.
> http://activemq.apache.org/camel/dead-letter-channel.html
> http://activemq.apache.org/camel/error-handler.html
> 
> 
> This behavior needs to be changed since you want to WRITE to a database
> about this ERROR. Also you want to write to the database if it's an OK.
> 
> So we need to instruct Camel to use send failure exchanges to your
> processor where you can write ERROR in the database.
> 
> // so we setup the error handler to use DLC but with your processor as
> destination and with 0 redeliveries. 
> MyProcessor myProcessor = new MyProcessor();
> errorHandler(deadLetterChannel(myProcessor).maximumRedeliveries(0);
> from("jms:delivery-queue).recipientList().header(Constants.ROUTE_HEADER);
> 
> 
> But we still need to set the OK situation. So we can just do it as adding
> a .to with your processor.
> 
> from("jms:delivery-queue).recipientList().header(Constants.ROUTE_HEADER).to(myProcoessor);
> 
> Then in myProcessor you can detect if the Exchange is failed or not
> 
> public class MyProcessor
> 
> public void process(Exchange exchange) {
>   Boolean failed = exchange.isFailed();
>   If (isFailed) {
>      // write ERROR in DB
>   } else {
>      // write OK in DB
>   }
> }
> 
> 
> 
> 
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -- 
> View this message in context:
> http://www.nabble.com/Some-questions-tp19564827s22882p19614697.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Some-questions-tp19564827s22882p19656721.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to