Camel Endpoint DSL

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel Endpoint DSL

hakuseki
Hi

How can I combine the endpoint DSL with dynamic property definitions such as:

final String toStr = "{{shuttle.ftp.outgoing.url}}" +
    "&username={{shuttle.ftp.username}}" +
    "&password={{shuttle.ftp.password}}" +
    "&allowNullBody=false" +
    "&consumer.bridgeErrorHandler=true" +
    "&throwExceptionOnConnectFailed=true" +
    "&pollStrategy=#defaultPollStrategy";

from("{{shuttle.outgoing.transactions}}")
    .routeId("Sending-SHUTTLE-FTP")
    .autoStartup("{{shuttle.ftp.outgoing.startup}}")
    .wireTap("seda:ping")
    .to(toStr)
    .log("XML file(s) sent")
    .end();


What I’d like is to have the option to have our DEV environment setup using say FTP but in INTEGRATION and PROD it will be SFTP. Since the endpointDSL is somewhat “hardcoding” the endpoint I don’t really know how to do it

Thx

M
Reply | Threaded
Open this post in threaded view
|

RE: Camel Endpoint DSL

rannandale
Hi Mikael

When I've had to do things like this I use recipientList. Maybe worth a try?

-----Original Message-----
From: Mikael Andersson Wigander <[hidden email]>
Sent: Thursday, 23 April 2020 10:06
To: [hidden email]
Subject: Camel Endpoint DSL

Hi

How can I combine the endpoint DSL with dynamic property definitions such as:

final String toStr = "{{shuttle.ftp.outgoing.url}}" +
    "&username={{shuttle.ftp.username}}" +
    "&password={{shuttle.ftp.password}}" +
    "&allowNullBody=false" +
    "&consumer.bridgeErrorHandler=true" +
    "&throwExceptionOnConnectFailed=true" +
    "&pollStrategy=#defaultPollStrategy";

from("{{shuttle.outgoing.transactions}}")
    .routeId("Sending-SHUTTLE-FTP")
    .autoStartup("{{shuttle.ftp.outgoing.startup}}")
    .wireTap("seda:ping")
    .to(toStr)
    .log("XML file(s) sent")
    .end();


What I’d like is to have the option to have our DEV environment setup using say FTP but in INTEGRATION and PROD it will be SFTP. Since the endpointDSL is somewhat “hardcoding” the endpoint I don’t really know how to do it

Thx

M
Reply | Threaded
Open this post in threaded view
|

Re: Camel Endpoint DSL

gnodet
In reply to this post by hakuseki
Le jeu. 23 avr. 2020 à 10:06, Mikael Andersson Wigander <
[hidden email]> a écrit :

> Hi
>
> How can I combine the endpoint DSL with dynamic property definitions such
> as:
>

You can use property placeholders with the endpoint DSL, but the goal of
the
dsl is to provide some type safety for properties.  In order to do that,
you need to
know the endpoint type beforehand.  Soin your use case where the component
is not know, you can't leverage the endpoint dsl much.


>
> final String toStr = "{{shuttle.ftp.outgoing.url}}" +
>     "&username={{shuttle.ftp.username}}" +
>     "&password={{shuttle.ftp.password}}" +
>     "&allowNullBody=false" +
>     "&consumer.bridgeErrorHandler=true" +
>     "&throwExceptionOnConnectFailed=true" +
>     "&pollStrategy=#defaultPollStrategy";
>
> from("{{shuttle.outgoing.transactions}}")
>     .routeId("Sending-SHUTTLE-FTP")
>     .autoStartup("{{shuttle.ftp.outgoing.startup}}")
>     .wireTap("seda:ping")
>     .to(toStr)
>     .log("XML file(s) sent")
>     .end();
>
>
> What I’d like is to have the option to have our DEV environment setup
> using say FTP but in INTEGRATION and PROD it will be SFTP. Since the
> endpointDSL is somewhat “hardcoding” the endpoint I don’t really know how
> to do it
>
> Thx
>
> M



--
------------------------
Guillaume Nodet
Reply | Threaded
Open this post in threaded view
|

Re: Camel Endpoint DSL

hakuseki
Thx, that’s what I suspected!

M

> On 23 Apr 2020, at 11:26, Guillaume Nodet <[hidden email]> wrote:
>
> Le jeu. 23 avr. 2020 à 10:06, Mikael Andersson Wigander <
> [hidden email]> a écrit :
>
>> Hi
>>
>> How can I combine the endpoint DSL with dynamic property definitions such
>> as:
>>
>
> You can use property placeholders with the endpoint DSL, but the goal of
> the
> dsl is to provide some type safety for properties.  In order to do that,
> you need to
> know the endpoint type beforehand.  Soin your use case where the component
> is not know, you can't leverage the endpoint dsl much.
>
>
>>
>> final String toStr = "{{shuttle.ftp.outgoing.url}}" +
>>    "&username={{shuttle.ftp.username}}" +
>>    "&password={{shuttle.ftp.password}}" +
>>    "&allowNullBody=false" +
>>    "&consumer.bridgeErrorHandler=true" +
>>    "&throwExceptionOnConnectFailed=true" +
>>    "&pollStrategy=#defaultPollStrategy";
>>
>> from("{{shuttle.outgoing.transactions}}")
>>    .routeId("Sending-SHUTTLE-FTP")
>>    .autoStartup("{{shuttle.ftp.outgoing.startup}}")
>>    .wireTap("seda:ping")
>>    .to(toStr)
>>    .log("XML file(s) sent")
>>    .end();
>>
>>
>> What I’d like is to have the option to have our DEV environment setup
>> using say FTP but in INTEGRATION and PROD it will be SFTP. Since the
>> endpointDSL is somewhat “hardcoding” the endpoint I don’t really know how
>> to do it
>>
>> Thx
>>
>> M
>
>
>
> --
> ------------------------
> Guillaume Nodet

Reply | Threaded
Open this post in threaded view
|

Re: Camel Endpoint DSL

Claus Ibsen-2
In reply to this post by hakuseki
Hi

You are using java so you can use the powers of java and for example
have a method that returns the Endpoint instance, and then have one
implementation for DEV and another for PROD.
And they can build this instance using endpoint-dsl or uri string or whatever.

You can also use dependency injection and have 2 different classes
that builds the endpoint and then if you package/builder your app with
some filtering (like spring boot profiles) then it can pick either
classes accordingly.


On Thu, Apr 23, 2020 at 10:06 AM Mikael Andersson Wigander
<[hidden email]> wrote:

>
> Hi
>
> How can I combine the endpoint DSL with dynamic property definitions such as:
>
> final String toStr = "{{shuttle.ftp.outgoing.url}}" +
>     "&username={{shuttle.ftp.username}}" +
>     "&password={{shuttle.ftp.password}}" +
>     "&allowNullBody=false" +
>     "&consumer.bridgeErrorHandler=true" +
>     "&throwExceptionOnConnectFailed=true" +
>     "&pollStrategy=#defaultPollStrategy";
>
> from("{{shuttle.outgoing.transactions}}")
>     .routeId("Sending-SHUTTLE-FTP")
>     .autoStartup("{{shuttle.ftp.outgoing.startup}}")
>     .wireTap("seda:ping")
>     .to(toStr)
>     .log("XML file(s) sent")
>     .end();
>
>
> What I’d like is to have the option to have our DEV environment setup using say FTP but in INTEGRATION and PROD it will be SFTP. Since the endpointDSL is somewhat “hardcoding” the endpoint I don’t really know how to do it
>
> Thx
>
> M



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