hey Steve, I'm not aware of a way to do this with AMQ config alone, but I
have done this in Camel to allow us to triage errored out messages, etc.
I just added a processor in my onException() stmt to add headers to the JMS
message prior to sending to an error queue...
onException(Exception.class)
.handled(true).maximumRedeliveries(0)
.process(new Processor() {
public void process(Exchange exch) throws Exception {
Exception exception = (Exception)
exch.getProperty("CamelExceptionCaught");
exch.getIn().setHeader("CamelException",
exception.toString());
exch.getIn().setHeader("CamelFailureEndpoint",
exchange.getProperty(Exchange.FAILURE_ENDPOINT, String.class));
exch.getIn().setHeader("CamelToEndpoint",
exchange.getProperty(Exchange.TO_ENDPOINT, String.class););
}
})
.to("activemq:queue:errorQueue");
smozely wrote:
>
> Hi everybody,
>
> Just wanting to run some ideas about our design past the folks here and
> have a couple of questions from it.
> We are using ActiveMQ for our JMS
>
> We have a pretty simple processing pipeline where ...
> * Messages come in from various files
> * After small amount of filtering (different per file input) they get
> forwarded to a single JMS queue
> * From that JMS queue they go through various enrichments
> * Finally forwarded onto a downstream system
>
> The work I'm doing at the moment is around redelivery in case of failure,
> mainly wanting to handle failures in the enrichment process.
>
> So far I have setup the JMS config to work transacted and do re-deliveries
> as needed on any exception, finally being passed to the ActiveMQ dead
> letter queue.
>
> But a feature we would like to have is for dead letters to have some way
> of knowing what caused the failure (other than the log.) Something like
> adding the exception to exchange before going to the DLQ. This seems
> pretty easy to do as well ...
>
> But question is to do this, does this imply we should now use the camel
> provided redelivery and exception handling to handle the common errors
> (using onRedelivery to attach the cause to the exchange), but leave the
> JMS action as transacted to catch things like the whole JVM crashing, plug
> being pulled out?
>
> Just wanting to make sure I have the concepts right in my head.
>
> Cheers
> Steve
>
-----
Ben O'Day
IT Consultant -http://consulting-notes.com
--
View this message in context:
http://camel.465427.n5.nabble.com/Redelivery-Attach-Exception-cause-to-message-tp4471650p4475225.html
Sent from the Camel - Users mailing list archive at Nabble.com.