calling <setHeader> with <groovy> expression can delete message and headers
---------------------------------------------------------------------------
Key: SMX4-417
URL: https://issues.apache.org/activemq/browse/SMX4-417
Project: ServiceMix 4
Issue Type: Bug
Affects Versions: 4.0.0
Environment: OSX 10.6.1, Java(TM) SE Runtime Environment (build
1.6.0_15-b03-219)
Reporter: Paul Mietz Egli
I've got a route that takes an HTTP form post, does some transformations, and
sends an email. One of the transforms I'd like to do is to set a header value
based on the result of a Groovy expression. I found that setting a header with
<groovy>...</groovy> clears out the entire exchange. Setting a header using
<constant>...</constant> works fine.
Here's a route that I'm using to diagnose this problem:
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="jetty:http://0.0.0.0:8103/" />
<to uri="log:from jetty?showAll=true" />
<to uri="seda:transform" />
</route>
<route>
<from uri="timer:mytimer?period=30000"/>
<setHeader headerName="application">
<constant>TEST</constant>
</setHeader>
<to uri="log:from timer?showAll=true" />
<to uri="seda:transform"/>
</route>
<route>
<from uri="seda:transform" />
<setHeader headerName="fromGroovy">
<groovy>"my header is ${in.headers.application}"</groovy>
</setHeader>
<to uri="log:after set header?showAll=true" />
</route>
</camelContext>
Messages that originate from the timer look fine:
12:31:49,332 | INFO | mer?period=30000 | from timer |
rg.apache.camel.processor.Logger 88 |
Exchange[Id:ID-iago.local/53297-1257192385112/0-16,
Properties:{org.apache.camel.timer.name=mytimer,
org.apache.camel.timer.firedTime=Mon Nov 02 12:31:49 PST 2009,
org.apache.camel.timer.period=30000}, Headers:{application=TEST, firedTime=Mon
Nov 02 12:31:49 PST 2009}, BodyType:null, Body:null, Out: null]
12:31:49,335 | INFO | ansform thread:3 | after set header |
rg.apache.camel.processor.Logger 88 |
Exchange[Id:ID-iago.local/53297-1257192385112/0-17,
Properties:{org.apache.camel.timer.name=mytimer,
org.apache.camel.timer.firedTime=Mon Nov 02 12:31:49 PST 2009,
org.apache.camel.timer.period=30000}, Headers:{application=TEST, fromGroovy=my
header is TEST, firedTime=Mon Nov 02 12:31:49 PST 2009}, BodyType:null,
Body:null, Out: null]
Messages that originate in response to a request to
http://localhost:8103/?application=TEST appear to be lost after the header is
set with the <groovy> tag:
12:32:03,607 | INFO | 34102...@qtp13-1 | from jetty |
rg.apache.camel.processor.Logger 88 |
Exchange[Id:ID-iago.local/53297-1257192385112/0-18, Properties:{},
Headers:{application=TEST, Host=localhost:8103,
org.apache.camel.component.http.query=application=TEST, User-Agent=curl/7.19.0
(i386-apple-darwin9.7.0) libcurl/7.19.0 zlib/1.2.3, http.requestMethod=GET,
Accept=*/*},
BodyType:org.apache.camel.converter.stream.StreamCacheConverter.InputStreamCache,
Body:, Out: null]
12:32:03,611 | INFO | ansform thread:3 | after set header |
rg.apache.camel.processor.Logger 88 |
Exchange[Id:ID-iago.local/53297-1257192385112/0-19, Properties:{}, Headers:{},
BodyType:null, Body:null, Out: null]
The message after the <setHeader><groovy> is completely blank. I've tried
building the route with the Java DSL but it does the same thing. Anything
added after the <setHeader><groovy>... element is added to the message, but all
previous contents were lost.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.