You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by hanusto <ha...@gmail.com> on 2015/01/12 10:50:15 UTC

Possibility to track (monitor) inbound/outbound messages (request/response)

Hello everybody,

I am looking for the best way how to track or monitor (for example persist
info into database) inbound message (we are a server) such as request (for
example for WS) and our response (or fail).

For example, for the same functionality for outbound messages (where we are
client) we use custom implementation of
EventNotifierBase<ExchangeSendingEvent> for sending and ExchangeSentEvent
for info about received response.

I found JPA implementation for tracing messages
(http://camel.apache.org/tracer-example.html) using tracer. But for now I
don't know what can I expect from it.

Requirements are:
- trace inbound requests (messages) and responses for there (without
complete flow of route - no tracing the route)
- if some error occurs we need trace errors
- it could be based upon "FromEndpoint" - trace message only if
"FromEndpoint" is registered, otherwise no

Camel provides TraceEventHandler, maybe it is one way how to resolve it? For
implementation I would create custom Camel endpoint (as Tracer endpoint)
which encapsulates of persisting JpaTraceEventMessage entity. This component
will route JpaTraceEventMessage  to JPA endpoint only if "FromEndpoint" will
be configured as accepted, otherwise no. For pairing requests and responses
I can use "ExchangeId". But how to resolve last node in route, "ToNode" will
be blank? In Out.Body there will be response, right? 

Or Camel provides some types of events such as
ExchangeSendingEvent/ExchangeSentEvent?

Thank you very much in advice

Tomas



--
View this message in context: http://camel.465427.n5.nabble.com/Possibility-to-track-monitor-inbound-outbound-messages-request-response-tp5761583.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possibility to track (monitor) inbound/outbound messages (request/response)

Posted by hanusto <ha...@gmail.com>.
Thanks Willem, I did it via onComplete and onFailure as implementation of
Processor, Synchronization.

Tomas



--
View this message in context: http://camel.465427.n5.nabble.com/Possibility-to-track-monitor-inbound-outbound-messages-request-response-tp5761583p5762237.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possibility to track (monitor) inbound/outbound messages (request/response)

Posted by Willem Jiang <wi...@gmail.com>.
You may consider to use the OnCompletion[1] to process the response message.
[1]http://camel.apache.org/oncompletion.html


Willem Jiang

Red Hat, Inc.

Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem

On Mon, Jan 12, 2015 at 5:50 PM, hanusto <ha...@gmail.com> wrote:

> Hello everybody,
>
> I am looking for the best way how to track or monitor (for example persist
> info into database) inbound message (we are a server) such as request (for
> example for WS) and our response (or fail).
>
> For example, for the same functionality for outbound messages (where we are
> client) we use custom implementation of
> EventNotifierBase<ExchangeSendingEvent> for sending and ExchangeSentEvent
> for info about received response.
>
> I found JPA implementation for tracing messages
> (http://camel.apache.org/tracer-example.html) using tracer. But for now I
> don't know what can I expect from it.
>
> Requirements are:
> - trace inbound requests (messages) and responses for there (without
> complete flow of route - no tracing the route)
> - if some error occurs we need trace errors
> - it could be based upon "FromEndpoint" - trace message only if
> "FromEndpoint" is registered, otherwise no
>
> Camel provides TraceEventHandler, maybe it is one way how to resolve it?
> For
> implementation I would create custom Camel endpoint (as Tracer endpoint)
> which encapsulates of persisting JpaTraceEventMessage entity. This
> component
> will route JpaTraceEventMessage  to JPA endpoint only if "FromEndpoint"
> will
> be configured as accepted, otherwise no. For pairing requests and responses
> I can use "ExchangeId". But how to resolve last node in route, "ToNode"
> will
> be blank? In Out.Body there will be response, right?
>
> Or Camel provides some types of events such as
> ExchangeSendingEvent/ExchangeSentEvent?
>
> Thank you very much in advice
>
> Tomas
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Possibility-to-track-monitor-inbound-outbound-messages-request-response-tp5761583.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>