You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by fab <me...@instilled.org> on 2013/01/03 12:47:20 UTC

Referencing constants in a (spring) route definition

Hello all, 

I'm using spring to define camel routes and was wondering if it is possilbe
to reference constants in a java class as the endpoint name, something like



The /<util:constant ...>/ part is standard Spring syntax where /util/ points
to the namespace
http://www.springframework.org/schema/util/spring-util-3.1.xsd. 

Thanks, 

Fabio



--
View this message in context: http://camel.465427.n5.nabble.com/Referencing-constants-in-a-spring-route-definition-tp5724830.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Referencing constants in a (spring) route definition

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Jan 6, 2013 at 4:04 PM, fab <me...@instilled.org> wrote:
> Hi Clause,
>
> Thanks, that makes sense indeed. I was hoping there was another solution.
>

You could possible use a dynamic to as here
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

And then use SpEL as the expression language to refer to a the constant.

An alternative would be to add support to Camel properties component
to be able to resolve
constant from java classes. As you can do with the spring:util namespace.





> Cheers,
> Fabio
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Referencing-constants-in-a-spring-route-definition-tp5724830p5725008.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

Re: Referencing constants in a (spring) route definition

Posted by fab <me...@instilled.org>.
Hi Clause, 

Thanks, that makes sense indeed. I was hoping there was another solution. 

Cheers, 
Fabio



--
View this message in context: http://camel.465427.n5.nabble.com/Referencing-constants-in-a-spring-route-definition-tp5724830p5725008.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Referencing constants in a (spring) route definition

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

This is not possible. You cannot use the spring XML tags inside <camelContext>.
When you are inside <camelContext> then its all Camel XML.



On Thu, Jan 3, 2013 at 12:47 PM, fab <me...@instilled.org> wrote:
> Hello all,
>
> I'm using spring to define camel routes and was wondering if it is possilbe
> to reference constants in a java class as the endpoint name, something like
>
>
>
> The /<util:constant ...>/ part is standard Spring syntax where /util/ points
> to the namespace
> http://www.springframework.org/schema/util/spring-util-3.1.xsd.
>
> Thanks,
>
> Fabio
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Referencing-constants-in-a-spring-route-definition-tp5724830.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