You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by erstanl <er...@gmail.com> on 2013/01/18 17:17:11 UTC

Spring XML configuration variables

Sorry if this is the wrong forum for this question. I am trying to build a
camel route that consumes from a JMS queue and uses a selector. The problem
is, I would like to use a selector based upon a spring variable. I can't
seem to convince spring/camel to dereference that variable. What am I
missing? This is the config:

<route>
			<from uri="q:queue:queue/hc/response?selector=correlatorId%3D${g.id}" />
			<log message="Got a response for ${header.correlationId}"/>
			<aggregate strategyRef="healthCheckAggregationStrategy"
completionTimeout="3000">
				<correlationExpression>
					<simple>${header.correlationId}</simple>
				</correlationExpression>
				<log message="End result is ${body}"/>
				<multicast>
					<to uri="bean:b1?method=add"/>
					<to uri="bean:b2?method=put"/>
				</multicast>
			</aggregate>
		</route>

This is the error:
javax.jms.InvalidSelectorException: correlatorId=${header.correlatorId}

Thanks for any info. Im hoping this is a rather common simple problem.
Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Spring-XML-configuration-variables-tp5725772.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Spring XML configuration variables

Posted by erstanl <er...@gmail.com>.
Thanks for the quick reply Claus.

For those who run into the same issue, this was the change I made to the
route:
<from uri="q:queue:queue/hc/response?selector=correlatorId%3D'{{g.id}}'" />

And more importantly, I had to comment out my spring
<context:property-placeholder /> and implement this:

So I replaced this: 
	<context:property-placeholder location="/WEB-INF/g.properties" />

with this: 

	<bean id="bridgePropertyPlaceholder"
class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
		<property name="location" value="/WEB-INF/g.properties"/>
	</bean>

All is well at the Camel farm.



--
View this message in context: http://camel.465427.n5.nabble.com/Spring-XML-configuration-variables-tp5725772p5725783.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Spring XML configuration variables

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Welcome to the community. This is the right forum, the user forum.

See this FAQ about your spring placeholder issue
http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html


On Fri, Jan 18, 2013 at 5:17 PM, erstanl <er...@gmail.com> wrote:
> Sorry if this is the wrong forum for this question. I am trying to build a
> camel route that consumes from a JMS queue and uses a selector. The problem
> is, I would like to use a selector based upon a spring variable. I can't
> seem to convince spring/camel to dereference that variable. What am I
> missing? This is the config:
>
> <route>
>                         <from uri="q:queue:queue/hc/response?selector=correlatorId%3D${g.id}" />
>                         <log message="Got a response for ${header.correlationId}"/>
>                         <aggregate strategyRef="healthCheckAggregationStrategy"
> completionTimeout="3000">
>                                 <correlationExpression>
>                                         <simple>${header.correlationId}</simple>
>                                 </correlationExpression>
>                                 <log message="End result is ${body}"/>
>                                 <multicast>
>                                         <to uri="bean:b1?method=add"/>
>                                         <to uri="bean:b2?method=put"/>
>                                 </multicast>
>                         </aggregate>
>                 </route>
>
> This is the error:
> javax.jms.InvalidSelectorException: correlatorId=${header.correlatorId}
>
> Thanks for any info. Im hoping this is a rather common simple problem.
> Thanks.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Spring-XML-configuration-variables-tp5725772.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen