Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 58410 invoked from network); 9 Dec 2008 14:37:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Dec 2008 14:37:24 -0000 Received: (qmail 5200 invoked by uid 500); 9 Dec 2008 14:37:36 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 5176 invoked by uid 500); 9 Dec 2008 14:37:36 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 5165 invoked by uid 99); 9 Dec 2008 14:37:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2008 06:37:36 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2008 14:37:22 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1LA3hq-00088x-T7 for camel-user@activemq.apache.org; Tue, 09 Dec 2008 06:36:58 -0800 Message-ID: <20915821.post@talk.nabble.com> Date: Tue, 9 Dec 2008 06:36:58 -0800 (PST) From: efender To: camel-user@activemq.apache.org Subject: Re: Saving original destination when sending to DLQ In-Reply-To: <5380c69c0812090555y521e8b1fgc8e6ece8603593e7@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: eric+nabble@fender.net References: <20914367.post@talk.nabble.com> <5380c69c0812090555y521e8b1fgc8e6ece8603593e7@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Here's my entire spring context. What I'm trying to implement is a form of guaranteed message processing. This is just a proof of concept, so ignore the Foo/Bar/Baz names and such. Flow: User requests to block another user. BlockUserRequest is created and sent to jms:queue:dynamicQueues/BlockUserQueue com.webshots.messaging.ContentEnricher simulates DB lookup of the blocked user's e-mail and other user IDs with the same e-mail enriched BlockUserRequest is sent to jms:queue:dynamicQueues/Bar (handled by com.webshots.messaging.Bar) and jms:queue:dynamicQueues/Baz (handled by com.webshots.messaging.Baz) to perform part of the functionality com.webshots.messaging.Baz always throws an Exception, just for testing message sent to jms:queue:dynamicQueues/Baz ends up in jms:queue:dynamicQueues/DLQ and com.webshots.messaging.DeadLetterPersistanceProcessor mocks saving it to a DB (and possibly sends an e-mail) In com.webshots.messaging.DeadLetterPersistanceProcessor I need to know what Exception caused the message to be routed to the DLQ and what the original destination was. Then I can create a web interface to the stored dead letters where an administrator can view/edit the message and exception contents and resend or discard. If there's a better way to implement this, please feel free to let me know. Thanks. com.webshots.messaging Claus Ibsen-2 wrote: > > Hi > > Could you post your route, to help get a view of your problem? > > To my knowledge the Exchange that is routed to DLC is the "original" > exchange as it was before it was processed by the node in the route > graph that failed. So if this node is a JMS producer the exchange > should have the JMS headers as well? > > For example: > from(x).process(y).to("jms:zzz"); > > If the error happens in the (to jms:zzz) the Exchange that is routed > to DLQ is how the exchange looks like from the output of the > process(y) node. > > But it helps if you could show the route and pin point where the error > happens > > > > /Claus Ibsen > Apache Camel Committer > Blog: http://davsclaus.blogspot.com/ > > > > On Tue, Dec 9, 2008 at 2:07 PM, efender wrote: >> >> How can I record the original destination when routing to my DLQ? >> >> I've tried a custom processor which does this: >> >> public void process(Exchange exchange) throws Exception { >> org.apache.camel.Message in = exchange.getIn(); >> org.apache.camel.Message out = in.copy(); >> out.setHeader("originalDestination", >> in.getHeader("JMSDestination")); >> exchange.setProperty("originalDestination", >> in.getHeader("JMSDestination")); >> exchange.setOut(out); >> } >> >> But neither the property nor the header is set in my bean which listens >> to >> the DLQ. Do I need to modify/subclass >> org.apache.camel.processor.DeadLetterChannel to get this behavior? >> >> Also, I'd like to save the original Exception that caused the message to >> get >> routed to the DLQ as well. I see that it is stored in >> org.apache.camel.processor.DeadLetterChannel.FAILURE_HANDLED and >> CamelCauseException, but those properties disappear by the time the >> message >> gets to the DLQ. >> >> Any recommendations on how to save this info in a best practice sort of >> way? >> >> Thanks. >> -- >> View this message in context: >> http://www.nabble.com/Saving-original-destination-when-sending-to-DLQ-tp20914367s22882p20914367.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Saving-original-destination-when-sending-to-DLQ-tp20914367s22882p20915821.html Sent from the Camel - Users mailing list archive at Nabble.com.