servicemix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Mietz Egli (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SMX4-417) calling <setHeader> with <groovy> expression can delete message and headers
Date Mon, 02 Nov 2009 21:05:52 GMT

    [ https://issues.apache.org/activemq/browse/SMX4-417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=55127#action_55127
] 

Paul Mietz Egli commented on SMX4-417:
--------------------------------------

Steps to reproduce:

1. Unpack apache-servicemix-4.0.0.tar.gz.
2. Start ServiceMix and run "features/install camel-jetty" and "features/install camel-groovy".
3. Build the attached project and copy the JAR file to $SERVICEMIX_HOME/deploy
4. Tail the servicemix.log file to see the timer-initiated messages going by.
5. Trigger a message from jetty using "curl http://localhost:8103/?application=TEST".

Observation: message headers are lost for jetty but retained for timer.

> 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
>         Attachments: SMX4-417.tar.gz
>
>
> 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  | 34102763@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.


Mime
View raw message