camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apara <ap...@standardset.com>
Subject How to pass properties between endpoints...
Date Mon, 02 Sep 2013 02:06:49 GMT
Before converting the event to JSON, I would like to store some variables
from the event and later use them in a to: destination.

So, am using header to stash away the values prior to conversion.  Is this
the best way of doing this, or should I be using properties?

        <camel:route>
            ...
            
            <camel:setHeader headerName="userId">
                <camel:simple
resultType="java.lang.Integer">${body.userId}</camel:simple>
            </camel:setHeader>

            <camel:setHeader headerName="eventName">
                <camel:simple
resultType="java.lang.String">${body.class.simpleName}</camel:simple>
            </camel:setHeader>

            <camel:marshal>
                <camel:json library="Jackson"/>
            </camel:marshal>

            <camel:convertBodyTo type="java.lang.String" />

            <camel:to
uri="bean:drupalRestService?method=notifyEvent(${in.header.userId},
${in.header.eventName}, ${body})" />

        </camel:route>

However, when I try to use the properties, I always a runtime exception
telling me that a PropertiesComponent needs to be defined inside of the
camel context.  However, I am not sure how to create a properties component
inside of the camel context.  I tried with just <properties/> but that did
not quite do the trick.

Any clues?

Thanks.
-AP_





--
View this message in context: http://camel.465427.n5.nabble.com/How-to-pass-properties-between-endpoints-tp5738449.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message