You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nicolas74 <nm...@gnubila.fr> on 2015/11/09 16:02:46 UTC

Dynamic URI in From (header)

Hello,

I would like to use a dynamic URI with the consumer of my own custom
component.
I'm using $simple{header.myHeader} in the URI, however
$simple{header.myHeader} is not replaced by the value...

I checked the documentation, but there is no information about what I'm
trying to do. The only tip I found is about a dynamic URI in to
(http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html)

How can I proceed ?

Code snippet:
1: A first route parses a CSV to retrieve a list of values
2: The csvProcessor sets a list of values (string) into headers
3: I use the camel:split on this list of values
4: I start the JOB route based on my own component, and I try to use the
dynamic URI but the value is not interpreted...

        <camel:route id="RETRIEVE_INFORMATION" >
             <camel:from uri="file:{{csv-directory}}?consumer.delay=5000" />
// 1
                <camel:unmarshal>
                    <camel:csv useMaps="true" />
                </camel:unmarshal>
                <camel:process ref="csvProcessor" /> // 2
                <camel:split> // 3
                    <camel:simple>${header.myHeader}</camel:simple>
                    <camel:log message="@@@@
${header.myHeader[{property.CamelSplitIndex}]}" />    // Value is properly
displayed here
                    <camel:to uri="direct:KICK_OFF" />
                </camel:split>
        </camel:route>
        <camel:route id="JOB" autoStartup="false" > // 4
            <camel:from
uri="myCustomComponent:...myparameter=$simple{header.myHeader[{property.CamelSplitIndex}]}"
/>
            <camel:to uri="direct:SHUTDOWN" />
        </camel:route>
	<camel:route id="KICK_OFF" >
		<camel:from uri="direct:KICK_OFF" />
		<camel:log message="# KICK_OFF #" />
		<camel:to uri="controlbus:route?routeId=JOB&amp;action=start" />
	</camel:route>


Best,
Nicolas.



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-URI-in-From-header-tp5773537.html
Sent from the Camel - Users mailing list archive at Nabble.com.