Hi

Can you try using Camel 2.12.x or better with the latest 2.13 as the
stream caching support has been improved in these releases.

If its still an issue we may want to take a look at letting Camel
reset the stream cache (if needed) when you use custom event
notifiers.

On Sun, Apr 13, 2014 at 8:57 PM, Henrique Viecili <viec...@gmail.com> wrote:
> I've just faced an interesting issue with a StreamCache body being
> 'exausted' after calling exchange.getIn().getBody(String.class) inside an
> EventNotifier
>
> I'm using Camel 2.10.0 (inside JBoss Fuse 6.0) and captured an
> ExchangeCreatedEvent on a HTTP endpoint (input). The payload was an
> instance of InputStreamCache and after the EventNotifier executed I got a
> 'Premature End of File' trying to parse the body as xml in the pipeline.
>
> Looking at the source code of InputStreamCache (extends
> ByteArrayInputStream) the writeTo method uses IOHelper.copy which
> 'consumes' the underlying byte array, so a next call would throw some
> IOException. I reckon this behaviour is correct according to the interface
> StreamCache.
>
> What I wonder is whether the automatic TypeConversion should (or not) try
> to reset() the StreamCache after doing the type conversion, avoiding such
> situations.
>
> Does this make sense? Is this fixed in the latest versions or I should
> raise a JIRA?
>
> Regards,
> Henrique Viecili



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to