Stream handling inconsistent.
-----------------------------
Key: CAMEL-5008
URL: https://issues.apache.org/jira/browse/CAMEL-5008
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 2.8.2
Environment: Mac OX 10.7
Reporter: Sebastian Rühl
Attachments: StreamingTest.java
When working with streams, stream caching must be activated in order to use
log:set trace, otherwise the streams will be consumed, as stated here
http://camel.apache.org/jbi.html ("#Using Streaming Bodies"). When the stream
caching now gets activated, the streams will be reseted after each step (as far
as I Understand). This makes it impossible to work with InputStreams in a pipe
manner (e.g. Read the first char, then in the next step work with the next
chars), as the stream is after this every time in the beginning.
I would except that the stream caching provides a mechanism for the "user" to
be able to read it more than once. Also its the right procedure to reset the
streams after they are traced with the tracing mechanism, BUT the should be
reseted to the state they were before and not to the very first beginning. I
didn't dig into the code that deep but it seems that exactly this happens from
user perspective.
So to summarize there are several problems:
- Working in stream in camel is impossible when log:set debug trace get
enabled. (Thus enable Stream caching)
- When Stream caching is enabled it becomes impossible to work with "stream
pointers" as camel reset the streams to the very beginning.
I illustrated the problem in the attached jUnit test.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira