[ 
https://issues.apache.org/jira/browse/CAMEL-19512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737992#comment-17737992
 ] 

Claus Ibsen commented on CAMEL-19512:
-------------------------------------

Using Camel's StreamCache objects like you do with InputStreamCache always 
require to use them with stream caching enabled. In fact end users are NOT 
supposed to create and use these classes themselves. They are part of Camel's 
stream caching functionality. Using these classes are for advanced use-cases 
such as in special components or addons.

Also beware when using any kind of Stream object (InputStream) then you can 
only read them once, and you need to reset them (if they support this etc.).

Read more at
https://camel.apache.org/manual/stream-caching.html

For changes in Camel 3.20.x then go see the changelog / git commits or 
whatever. Camel releases are fixing bugs and whatnot.



> Simple language not working anymore with InputStreamCache body
> --------------------------------------------------------------
>
>                 Key: CAMEL-19512
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19512
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.20.3
>         Environment: JDK 11
>            Reporter: Xilai Dai
>            Priority: Minor
>         Attachments: test-setheader.zip
>
>
> It seems there is a regression from Camel 3.20.3 which is the Simple language 
> not working anymore with InputStreamCache body.
> Given that a simple route:
> {code}
>               from("timer:cTimer_1" + "?period=" + 1 + "&repeatCount=" + 1 + 
> "&delay=" + 1)
>                               .process(new org.apache.camel.Processor() {
>                                       public void 
> process(org.apache.camel.Exchange exchange) throws Exception {
>                                               ByteBuffer buffer = 
> ByteBuffer.allocate(8);
>                                               buffer.putLong(15);
>                                               InputStreamCache iscache = new 
> InputStreamCache(buffer.array());
>                                               
> exchange.getIn().setBody(iscache);
>                                       }
>                               }).process(new org.apache.camel.Processor() {
>                                       public void 
> process(org.apache.camel.Exchange exchange) throws Exception {
>                                               System.out.println("abc: " + 
> exchange.getIn().getBody().getClass().getName());
>                                       }
>                               }).setHeader("newCustomer").simple("${body}")
>                               .log(org.apache.camel.LoggingLevel.WARN, 
> "MyRoute.cLog_4",
>                                               "header newCustomer value is: 
> ${header.newCustomer}");
> {code}
> the value of header.newCustomer is always null, whereas in Camel 3.20.2 or 
> earlier version, it worked well.
> Attached a sample project for easily reproduce the issue.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to