Logged a JIRA ticket
https://issues.apache.org/jira/browse/CAMEL-6995

On Thu, Nov 21, 2013 at 5:22 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> Ah yeah sounds like contentCache also caches the created expression
> from the jython script.
> And depending how that is implemented in jython it may leave data from
> last evaluation.
> Not sure if there is a "reset" method.
>
> Otherwise we cannot really optimize this in Camel and would need to
> create the expression from the script on each message.
> Though there can be times where you want to reuse existing compiled
> script for performance.
>
> I guess we would need to add a new option in the language component to
> let users decide if they want to reuse compiled script
> or not. Then they can turn that on in special cases where they want
> performance and can reuse it.
>
>
>
>
> On Thu, Nov 21, 2013 at 5:12 PM, APinto <armeniopi...@gmail.com> wrote:
>> Hello Claus, thank you!
>>
>> For the time being, we only need to inject new message headers, read
>> existing ones, etc.. But in the future we might have requirements to change
>> the body, for example.
>>
>> Reading the language component documentation, it seems to do exactly what we
>> need! I also tried it and it works fine, with a small problem that I managed
>> to work around.
>>
>> The problem is that, when the contentCache attribute is true, the script
>> works a few times and then stops working. For example, if we have the Jython
>> script:
>>
>> request.headers['NewTestHeader']="Hello world!"
>>
>> ... and the Camel code:
>>
>> <to uri="language:python:classpath:test.py?transform=false"/>
>> <log message="${in.header.NewTestHeader}"/>
>>
>> ... it prints "Hello world!" for the first few messages, and then the header
>> doesn't exist for the remaining ones. If the contentCache variable is false,
>> everything works fine. I am able to replicate the problem in an isolated
>> Camel context.
>>
>> If you think that this is a problem related with Camel 2.12.1 and not with
>> Jython 2.5.3, I am happy so submit a bug report.
>>
>> Thank you very much again, regards,
>>
>> AP
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Transform-Camel-and-null-message-bodies-tp5743617p5743637.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> 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



-- 
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

Reply via email to