You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by boris <bo...@barclays.com> on 2013/07/16 15:46:30 UTC

conditional uri

How could I have a conditional uri string?
For example,
I have <from uri="prod_uri"   in production and <from uri="direct:start" 
for testing.
I want to have a single xml file for both and manage uri string
conditionally.
Thanks,
Boris



--
View this message in context: http://camel.465427.n5.nabble.com/conditional-uri-tp5735724.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: conditional uri

Posted by David Karlsen <da...@gmail.com>.
You could either make it configurable with placeholders:
http://camel.apache.org/using-propertyplaceholder.html

or use a when choice: http://camel.apache.org/spring-xml-extensions.html


2013/7/16 boris <bo...@barclays.com>

> How could I have a conditional uri string?
> For example,
> I have <from uri="prod_uri"   in production and <from uri="direct:start"
> for testing.
> I want to have a single xml file for both and manage uri string
> conditionally.
> Thanks,
> Boris
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/conditional-uri-tp5735724.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Re: conditional uri

Posted by Bart Horré <ba...@anova.be>.
I often usen a mechanism to conditionally route based on test or production
environment where I load a spring property to identify the environment and
create the endpoints based on the environment.

In Java DSL you could make an abstract route builder to house the common
logic and write to direct: endpoint. You can then create a test or
production routebuilder based on the environment which would read from the
direct: endpoint and forward to the real endpoints


On Tue, Jul 16, 2013 at 9:49 PM, Jan Matèrne (jhm) <ap...@materne.de>wrote:

> If your xml-route-definition is inside a spring configuration, spring
> properties should be possible.
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Chris Wolf [mailto:cwolf.algo@gmail.com]
> > Gesendet: Dienstag, 16. Juli 2013 16:17
> > An: users@camel.apache.org
> > Betreff: Re: conditional uri
> >
> > It depends on what you mean by "conditional" -  if you mean conditional
> > at route-definition time, you can use property placeholders and/or
> > Language Expressions.
> >
> > If you mean conditional at runtime, then I'm pretty sure you can only
> > do that with producer endpoints (i.e. "to" endpoints) see:
> >
> > http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
> >
> > If you want conditional runtime consumer endpoints, the only solution I
> > have been able to come up with is dynamically created routes that are
> > created at runtime; this logic is encapsulated in a custom processor.
> >
> >     -Chris
> >
> >
> >
> >
> > On Tue, Jul 16, 2013 at 9:46 AM, boris <bo...@barclays.com>
> > wrote:
> > > How could I have a conditional uri string?
> > > For example,
> > > I have <from uri="prod_uri"   in production and <from
> > uri="direct:start"
> > > for testing.
> > > I want to have a single xml file for both and manage uri string
> > > conditionally.
> > > Thanks,
> > > Boris
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > > http://camel.465427.n5.nabble.com/conditional-uri-tp5735724.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Bart Horré
Anova r&d bvba

AW: conditional uri

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
If your xml-route-definition is inside a spring configuration, spring
properties should be possible.

Jan

> -----Ursprüngliche Nachricht-----
> Von: Chris Wolf [mailto:cwolf.algo@gmail.com]
> Gesendet: Dienstag, 16. Juli 2013 16:17
> An: users@camel.apache.org
> Betreff: Re: conditional uri
> 
> It depends on what you mean by "conditional" -  if you mean conditional
> at route-definition time, you can use property placeholders and/or
> Language Expressions.
> 
> If you mean conditional at runtime, then I'm pretty sure you can only
> do that with producer endpoints (i.e. "to" endpoints) see:
> 
> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
> 
> If you want conditional runtime consumer endpoints, the only solution I
> have been able to come up with is dynamically created routes that are
> created at runtime; this logic is encapsulated in a custom processor.
> 
>     -Chris
> 
> 
> 
> 
> On Tue, Jul 16, 2013 at 9:46 AM, boris <bo...@barclays.com>
> wrote:
> > How could I have a conditional uri string?
> > For example,
> > I have <from uri="prod_uri"   in production and <from
> uri="direct:start"
> > for testing.
> > I want to have a single xml file for both and manage uri string
> > conditionally.
> > Thanks,
> > Boris
> >
> >
> >
> > --
> > View this message in context:
> > http://camel.465427.n5.nabble.com/conditional-uri-tp5735724.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.


Re: conditional uri

Posted by Chris Wolf <cw...@gmail.com>.
It depends on what you mean by "conditional" -  if you mean
conditional at route-definition time, you can use property placeholders
and/or Language Expressions.

If you mean conditional at runtime, then I'm pretty sure you can only do that
with producer endpoints (i.e. "to" endpoints) see:

http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

If you want conditional runtime consumer endpoints, the only solution I have
been able to come up with is dynamically created routes that are created at
runtime; this logic is encapsulated in a custom processor.

    -Chris




On Tue, Jul 16, 2013 at 9:46 AM, boris <bo...@barclays.com> wrote:
> How could I have a conditional uri string?
> For example,
> I have <from uri="prod_uri"   in production and <from uri="direct:start"
> for testing.
> I want to have a single xml file for both and manage uri string
> conditionally.
> Thanks,
> Boris
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/conditional-uri-tp5735724.html
> Sent from the Camel - Users mailing list archive at Nabble.com.