You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Joni Nousiainen <jo...@codecenter.fi> on 2014/01/31 13:34:03 UTC
Problem with tracing streams (and stream caching)
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
Re: Problem with tracing streams (and stream caching)
Posted by Joni Nousiainen <jo...@codecenter.fi>.
Of course I forgot to include version, it's only mentioned three times
in the posting instructions. :)
I'm using version 2.12.2. I tried the latest snapshot version
(2.13-SNAPSHOT) as you suggested. Same problem exists with it as well.
BR,
Joni
On 31.1.2014 22:05, Claus Ibsen wrote:
> What Camel version do you use? Try to upgrade to latest. And try
> SNAPSHOT code also.
Re: Problem with tracing streams (and stream caching)
Posted by Claus Ibsen <cl...@gmail.com>.
What Camel version do you use? Try to upgrade to latest. And try
SNAPSHOT code also.
On Fri, Jan 31, 2014 at 1:34 PM, Joni Nousiainen
<jo...@codecenter.fi> wrote:
> 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
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io
Re: Problem with tracing streams (and stream caching)
Posted by Joni Nousiainen <jo...@codecenter.fi>.
Thanks for the tip! I tried upgrading to the latest version of JDK 7
(1.7.0_51). Unfortunately this had no effect on the problem.
BR,
Joni
On 11.2.2014 23:36, Christian Müller wrote:
> First of all, you should upgrade to a more recent Java version.
>
> Best,
>
> Christian
Re: Problem with tracing streams (and stream caching)
Posted by Christian Müller <ch...@gmail.com>.
First of all, you should upgrade to a more recent Java version.
Best,
Christian
-----------------
Software Integration Specialist
Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member
https://www.linkedin.com/pub/christian-mueller/11/551/642
On Tue, Feb 11, 2014 at 1:45 PM, Joni Nousiainen <
joni.nousiainen@codecenter.fi> wrote:
> I'm still having this problem is so I'm bumping up the thread by attaching
> a sample Maven project to demonstrate the issue. Project includes a a
> single JUnit test which is failing because of own Tracer implementation.
>
> Here's my mvn --version output if needed:
>
> Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
> Maven home: C:\Dev\apache-maven-3.0.4\bin\..
> Java version: 1.7.0_17, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_17\jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>
> BR,
> Joni
>
Re: Problem with tracing streams (and stream caching)
Posted by Joni Nousiainen <jo...@codecenter.fi>.
I'm still having this problem is so I'm bumping up the thread by
attaching a sample Maven project to demonstrate the issue. Project
includes a a single JUnit test which is failing because of own Tracer
implementation.
Here's my mvn --version output if needed:
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: C:\Dev\apache-maven-3.0.4\bin\..
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_17\jre
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
BR,
Joni