Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A3728E36A for ; Fri, 11 Jan 2013 18:44:41 +0000 (UTC) Received: (qmail 22518 invoked by uid 500); 11 Jan 2013 18:44:41 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 22462 invoked by uid 500); 11 Jan 2013 18:44:41 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 22445 invoked by uid 99); 11 Jan 2013 18:44:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2013 18:44:40 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2013 18:44:34 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1TtjaP-0006F4-IB for users@camel.apache.org; Fri, 11 Jan 2013 10:44:13 -0800 Date: Fri, 11 Jan 2013 10:44:13 -0800 (PST) From: ncolomer To: users@camel.apache.org Message-ID: <1357929853553-5725420.post@n5.nabble.com> Subject: Retrieve failed Route from deadLetterChannel ? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Camel community, I am facing a problem using the Camel's deadLetterChannel. I have several Routes that process messages and delegate to a Route-scoped errorHandler when something bad happen (HTTP endpoint timeout for instance). What I try to achieve is to implement a generic Route as deadLetterChannel to handle all kind of Route failure and act accordingly (actually, persist object on the filesystem and send an email). The problem is that filename and mail subject are different, depending on the Route the failure was triggered from. I need to implement some logic to retrieve the failure context (i.e. from which Route it was triggered) and set some headers accordingly. Is there a possibility to retrieve failed Route (instance / ID or URI) via the Exchange object (Processor) ? If it's not the case, can we set headers in the Route specific errorHandler that will be used in the generic deadLetterChannel (worse as Route depends on caller) ? Do you see a better way ? My Java code currently looks like that : MyRoute route definition : from(MyRoute.URI).routeId(MyRoute.ID) .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage() .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay) .log(MyRoute.FAILURE).logHandled(true) .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true) .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false)) // ... Route's stuff ... DeadLetterRoute route definition : from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID) .process(new DeadLetterProcessor()) // Retrieves failed route and set headers accordingly .setHeader("from", simple("${properties:mail.from}")) .setHeader("to", simple("${properties:mail.to}")) .to("file:{{error.directory}}") .to("smtp:{{mail.server.url}}"); Thanks in advance for your help, Nicolas -- View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html Sent from the Camel - Users mailing list archive at Nabble.com.