You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "michael.esmann" <ca...@gmail.com> on 2016/12/19 10:32:09 UTC

Dynamically remove "from" endpoint

Hi,

We are using Camel 2.17.3 (blueprint) with Karaf 4.0.7

I would like to know if there is a way to exclude a "from" endpoint from a
route by a configuration property.
The reason is that we have many different environments and not all type of
endpoint exists in the environments.

A simple example: We always have a file input to be able to manually trigger
messages. And in this example we also have an sftp endpoint
  
  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
    <route>

      <from uri="file:inputDirectory"/>
      <from
uri="sftp:{{sftpserver}}/{{directory}}?username={{username}}&amp;password={{password}}"/>

      <to uri="file:outputDirectory"/>
    </route>

  </camelContext>

We do not have an sftp server in each environment. So I would like to
disable/remove the sftp input endpoint by some environment configuration.
I have tried to use "<choice>" with some "{{ }}" variable but I ended up
with illegal xml. A possibility could be to make the whole uri in the second
route configurable, but I would like to avoid that.

Any suggestions?

/Michael



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamically-remove-from-endpoint-tp5791687.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamically remove "from" endpoint

Posted by "michael.esmann" <ca...@gmail.com>.
Thank you for the quick reply !!

Saves me from using time on more experiments.

/Michael




--
View this message in context: http://camel.465427.n5.nabble.com/Dynamically-remove-from-endpoint-tp5791687p5791697.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamically remove "from" endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
No <from> cannot be dynamic.

Also its discouraged to have 2 or more <from> in the same route. This
will be removed in Camel 3.0.
Create 2 different routes, and then have autoStartup=false|true for
the FTP route depending on the environment.

You can use the simple language to check for a ENV property or something.

autoStartup="{{env:FTP_ENABLED}}"

On Mon, Dec 19, 2016 at 11:32 AM, michael.esmann
<ca...@gmail.com> wrote:
> Hi,
>
> We are using Camel 2.17.3 (blueprint) with Karaf 4.0.7
>
> I would like to know if there is a way to exclude a "from" endpoint from a
> route by a configuration property.
> The reason is that we have many different environments and not all type of
> endpoint exists in the environments.
>
> A simple example: We always have a file input to be able to manually trigger
> messages. And in this example we also have an sftp endpoint
>
>   <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>     <route>
>
>       <from uri="file:inputDirectory"/>
>       <from
> uri="sftp:{{sftpserver}}/{{directory}}?username={{username}}&amp;password={{password}}"/>
>
>       <to uri="file:outputDirectory"/>
>     </route>
>
>   </camelContext>
>
> We do not have an sftp server in each environment. So I would like to
> disable/remove the sftp input endpoint by some environment configuration.
> I have tried to use "<choice>" with some "{{ }}" variable but I ended up
> with illegal xml. A possibility could be to make the whole uri in the second
> route configurable, but I would like to avoid that.
>
> Any suggestions?
>
> /Michael
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamically-remove-from-endpoint-tp5791687.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2