You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by justinblandford <ju...@googlemail.com> on 2012/11/23 16:10:25 UTC

How do you build an endpoint string using a JVM argument

Hi,

I have a bean defined as follows:-

<bean id="mq" class="org.apache.activemq.camel.component.MQComponent"
	lazy-init="true">
	<property name="connectionFactory" ref="qcf" />
</bean>

that I use to access a queue connection factory.  So in my camel route the
endpoint looks like:-

<route><to uri="mq:myQueueName">

and this all works fine.  However, I want to externalise the queue
(myQueueName) so that I can provide it as a JVM argument.  I found the
following page:-

http://camel.apache.org/properties.html

which does the trick.  This works if I have the full uri in my JVM argument
i.e.

(endpointArg="mq:myQueueName")

and in my camel route I use the PropertiesComponent class to allow me to
access the JVM arg:-

<bean id="properties"
class="org.apache.camel.component.properties.PropertiesComponent">
	<property name="cache" value="false" />
</bean>

so that in my route I use the JVM arg as follows:-

<route><to uri="properties:endpointArg" />.

This also works fine.  However, I don't want to put the bean qualification
"mq:" in my JVM arg as this is a static property that will never change.

So when I take the bean qualification "mq:" out of the JVM arg so that it
looks like :-

(endpointArg="myQueueName")

and then change my camel route so that it looks like :-

<route><to uri="mq:properties:endpointArg" />.

it doesn't work.

Does anyone have any suggestions on how to get around this?

Regards,

Justin








--
View this message in context: http://camel.465427.n5.nabble.com/How-do-you-build-an-endpoint-string-using-a-JVM-argument-tp5723164.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: How do you build an endpoint string using a JVM argument

Posted by justinblandford <ju...@googlemail.com>.
Thanks, it worked.

Regards,

Justin



--
View this message in context: http://camel.465427.n5.nabble.com/How-do-you-build-an-endpoint-string-using-a-JVM-argument-tp5723164p5723247.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: How do you build an endpoint string using a JVM argument

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 23, 2012 at 4:10 PM, justinblandford
<ju...@googlemail.com> wrote:
> Hi,
>
> I have a bean defined as follows:-
>
> <bean id="mq" class="org.apache.activemq.camel.component.MQComponent"
>         lazy-init="true">
>         <property name="connectionFactory" ref="qcf" />
> </bean>
>
> that I use to access a queue connection factory.  So in my camel route the
> endpoint looks like:-
>
> <route><to uri="mq:myQueueName">
>
> and this all works fine.  However, I want to externalise the queue
> (myQueueName) so that I can provide it as a JVM argument.  I found the
> following page:-
>
> http://camel.apache.org/properties.html
>
> which does the trick.  This works if I have the full uri in my JVM argument
> i.e.
>
> (endpointArg="mq:myQueueName")
>
> and in my camel route I use the PropertiesComponent class to allow me to
> access the JVM arg:-
>
> <bean id="properties"
> class="org.apache.camel.component.properties.PropertiesComponent">
>         <property name="cache" value="false" />
> </bean>
>
> so that in my route I use the JVM arg as follows:-
>
> <route><to uri="properties:endpointArg" />.
>
> This also works fine.  However, I don't want to put the bean qualification
> "mq:" in my JVM arg as this is a static property that will never change.
>
> So when I take the bean qualification "mq:" out of the JVM arg so that it
> looks like :-
>
> (endpointArg="myQueueName")
>
> and then change my camel route so that it looks like :-
>
> <route><to uri="mq:properties:endpointArg" />.
>
> it doesn't work.
>

Try with
 <route><to uri="mq:{{endpointArg}}" />.

See more details at
http://camel.apache.org/using-propertyplaceholder.html


> Does anyone have any suggestions on how to get around this?
>
> Regards,
>
> Justin
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-do-you-build-an-endpoint-string-using-a-JVM-argument-tp5723164.html
> Sent from the Camel Development 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