Hi all!
I am trying to extend Camel's built-in Tracer's functionality by adding
my own TraceEventHandler implementation. The implementation places the
ProcessorDefinition and Exchange inside a wrapper object and then sends
it to another Camel route (trace route) by using
ProducerTemplate.sendBody(). Trace route then stores node and exchange
info (exchange ID, message headers etc.) into database, after which the
message body is stored to a file using Camel file component.
Trace route itself is working fine but I'm running into problems when I
try to apply it to inOutRoute below which is basically a HTTP proxy:
<camelContext id="inOutCamelContext"
xmlns="http://camel.apache.org/schema/spring" streamCache="true"
trace="true">
<route id="inOutRoute">
<from
uri="jetty://http://localhost:8898?matchOnUriPrefix=true&throwExceptionOnFailure=false&disableStreamCache=false&continuationTimeout=-1"
/>
<to
uri="http4://localhost:8899/?bridgeEndpoint=true&throwExceptionOnFailure=false"
/>
</route>
</camelContext>
HTTP client receives an empty response body instead of the one returned
by localhost:8899. If I remove the 'write message body to file' part of
trace route the response is correct. I've enabled stream cache on the
inOutRoute but that does not seem to help in this case. I've also tried
resetting the cached stream manually after the sendBody() call returns
but without luck; the client still gets an empty response.
Any suggestions what might be the cause?
A summary of my use case: I'm trying to come up with sort of a
general-purpose monitoring tool which could be plugged into any of our
other Camel contexts easily just by importing in the extended Tracer
(and setting streamCache and trace to true on the context of course).
BR,
Joni Nousiainen