niyasc
niyasc

Reputation: 4490

Asynchronous logging with Apache Camel

I'm trying to implement an asynchronous logger with Apache Camel. I want to log the request and response payload while calling a 3rd party API. Currently, I'm doing this using activemq as follows:

....
<!-- Prepare request -->
<to uri="activemq:loggingQueue??disableReplyTo=true&amp;preserveMessageQos=true"/>
<recipientList>
  <simple>http4:api.example.com</simple>
</recipientList>
.......

<route>
  <from uri="activemq:loggingQueue"/>
  <!-- log payload -->
</route>

Upvotes: 0

Views: 637

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55555

You can use an EventNotifier to hook into Camel that has events before/after a message is sent to an endpoint. You can then use that to write to your logs: http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html

And also log4j and other logging apis, often have various adapters to write the logs to files / over the network in a fast and asynchronous / batch fashion.

Upvotes: 2

Related Questions