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 90B8CE132 for ; Sat, 19 Jan 2013 08:07:07 +0000 (UTC) Received: (qmail 2738 invoked by uid 500); 19 Jan 2013 08:07:05 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 2273 invoked by uid 500); 19 Jan 2013 08:07:04 -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 2223 invoked by uid 99); 19 Jan 2013 08:07:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Jan 2013 08:07:02 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.210.182 as permitted sender) Received: from [209.85.210.182] (HELO mail-ia0-f182.google.com) (209.85.210.182) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Jan 2013 08:06:57 +0000 Received: by mail-ia0-f182.google.com with SMTP id w33so1972445iag.27 for ; Sat, 19 Jan 2013 00:06:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=jTvy+LeSHsI98aDAn+LS9FfUCZllDYuob2L0vlRgRM4=; b=KVJYo6QddipyBXiOvX5cCsnClaP2ZxmV1cMXwvMVlHGHhtYH2DZQhz9jczZyMiUctF lipsdughkM1c6KOMEX4HlWut7mnp/lPrZY40f4qqo9aV38TOGXIjqQTv435J3YI0LkIz m54mtdp1n6VUNCtnKXrVlb3oUbXt8L0YYhRTmuDNylDpn/qq9ggGoThB4wXCpH7ZFdpK BNtlQt+6KM5oZrgHLcucI/t0OnQKfshM32RYK3mqao149CzZffG6QzjgAVE8X5I2/WSv BrSJnpft6hLdclILtS6DbNOuJ11MJYKwzwHxaOdy3w3mWmSSbTwp8Cx+t6HYao3dI3Is W0XA== X-Received: by 10.50.33.233 with SMTP id u9mr4304124igi.39.1358582797086; Sat, 19 Jan 2013 00:06:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.7.16 with HTTP; Sat, 19 Jan 2013 00:06:17 -0800 (PST) In-Reply-To: <1358538749025-5725791.post@n5.nabble.com> References: <1358538749025-5725791.post@n5.nabble.com> From: Claus Ibsen Date: Sat, 19 Jan 2013 09:06:17 +0100 Message-ID: Subject: Re: how to intercept route builder "to" route for audit logging To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi See the blue box at http://camel.apache.org/servlet And this FAQ http://camel.apache.org/why-is-my-message-body-empty.html On Fri, Jan 18, 2013 at 8:52 PM, dvsridhar wrote: > Hi, > We have to provide audit log for our http routes, for which, we host bunch > http proxy routes using servlet component which routes the request to the > provider using http producer. > > The following route does wireTap after "from" and "to" routes. However, > when the wiretap finishes, i am getting the same from url in both logs. > > In my HttpLogProcessor I am using the following snippet to obtain endpoint > URL. In both the logs I get the same from end point URL and the response > code is null in the first log where as i get the correct response code on > the second log. In nutshell it is not printing the "to" route end point URL. > I could enable trace that prints whole lot for audit log, so, we don't need > all that stuff. > > HttpLogProcessor > ------------------------ > * > Message in = exchange.getIn(); > System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE)); > * > > > Route > ---------- > onException(Exception.class) > .handled(true) > .wireTap(direct:auditLog).end() > .process(new ErrorProcessor()); > > from("servlet://Proxy/Vendor/12345") > * .wireTap(direct:auditLog).end(); * > .process(new HttpHeaderProcessor()) > .routeId(routeId) > .to("https://ProivderHost:6081/Provider/Vendor/12345") > .process(new CleanupHeaderProcessor()) > * .wireTap(direct:auditLog).end(); * > > * from(direct:auditLog).process(new HttpLogProcessor()) > .to(jms:queue:LOG_QUEUE); > * > from("jms:queue:LOG_QUEUE?concurrentConsumers=3") > .bean(AuditLogProcessor.class,"log"); > > *Expected Result:* > 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://proxy-host:6081/Proxy/Vendor/12345,200 > > 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://proxy-host:6081/Proxy/Vendor/12345,200 > > *But what we are getting the following Log Trace > ------------ > * > 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://proxy-host:6081/Proxy/Vendor/12345,null > > 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://ProivderHost:6081/Provider/Vendor/12345,200 > > > Wondering how to do this? Do I need to do some sort interceptors to achieve > this? > > Any help appreciated. > > Thanks, > Sridhar > > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/how-to-intercept-route-builder-to-route-for-audit-logging-tp5725791.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cibsen@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen