camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvsridhar <dabbeeru.venkata.srid...@cgifederal.com>
Subject how to intercept route builder "to" route for audit logging
Date Fri, 18 Jan 2013 19:52:29 GMT
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.

Mime
View raw message