You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ChristianSchaefer <sy...@yahoo.de> on 2013/11/17 13:10:23 UTC

typesafe endpoint configuration approach

Hello there,

after working with a camel for some months I wondered from time to time if
there is a possibility to define endpoints a bit more typesafe way because
writing URI strings is prone to typos/property-mismatch and (imho) not
really supported by an IDE.
Furthermore the developing includes writing code, reading the doc to get
that property's name  and pasting it in the code.

As I didn't find anything like that except
(http://camel.465427.n5.nabble.com/Endpoint-URI-typesafety-td5733594.htm), I
had an idea to write the consumer config as the following file copy example
demonstrates.

(adapted from the camel in action book example in chapter 1):

*from(new FileConsumerTemplate("data/inbox")
                        .setNoop(true)
                        .setRecursive(true)
                        .get())

                    .log("going to copy file..")
                    .to("file:data/outbox");*

This way one could use endpoint specific template classes which implement
methods for the specific properties (enabling IDE auto suggestion) where one
could also put the camel documentation at. 

Have a look at the complete working example code (quickly hacked so there
are surely some points to optimize.)

http://pastebin.com/JvMQ3wpG
http://pastebin.com/Vn3z3sRc
http://pastebin.com/Zjs3Jrp3
(Alternatively the complete package in a zip:
https://dl.dropboxusercontent.com/u/34369176/typesafeProdCons.zip)

Tell/write me what you think please .
                         



--
View this message in context: http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: typesafe endpoint configuration approach

Posted by Claus Ibsen <cl...@gmail.com>.
I dont think this is a good idea as its too much work for a limited user base.

Defining options on an endpoint/component is using pure java
getter/setters (aka java bean properties).

To have fluent builder configuring with these bean properties is a
general problem. So if there is some tool that can generate builder
apis from getter/setters then that would be compelling.

To maintain all the code ourselves is too much work as we have 150+ components.



On Tue, Nov 19, 2013 at 12:29 AM, ChristianSchaefer
<sy...@yahoo.de> wrote:
> My proposed guess wasn't meant/thought as a replacement for the the string
> URI configuration of camel.
>
> I just thought that it could be a helpful addon especially for Java DSL
> users.
>
> Sure, the endpoint "templates" would require implementation for each
> endpoint type because they are different in some aspects.
>
> However, referring to the feedback a contribution is not really wanted in
> this case.
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391p5743469.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: typesafe endpoint configuration approach

Posted by ChristianSchaefer <sy...@yahoo.de>.
My proposed guess wasn't meant/thought as a replacement for the the string
URI configuration of camel.

I just thought that it could be a helpful addon especially for Java DSL
users.

Sure, the endpoint "templates" would require implementation for each
endpoint type because they are different in some aspects. 

However, referring to the feedback a contribution is not really wanted in
this case.







--
View this message in context: http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391p5743469.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: typesafe endpoint configuration approach

Posted by ChristianSchaefer <sy...@yahoo.de>.
Hi Willem,

is there an example of how to "define the Endpoint in the pure Java way,"?
Didn't find one.

 
regards
Christian Schäfer 



Willem.Jiang [via Camel] <ml...@n5.nabble.com> schrieb am 2:34 Montag, 18.November 2013:
 
Hi,   

I’m not a not a big fan of this type safe endpoint configuration. 

As the endpoints are different from each other, you cannot define a unified fluent API for all the endpoints. 
But Camel does support to define the Endpoint in the pure Java way, but it is not as easy as using the URI to setup the endpoint. 

BTW, the good part of URI is we can build the endpoint from Java, Spring or Blueprint without change any thing.   

--   
Willem Jiang 

Red Hat, Inc. 
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) 
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) 
Twitter: willemjiang   
Weibo: 姜宁willem 






On Sunday, November 17, 2013 at 8:10 PM, ChristianSchaefer wrote: 


> Hello there, 
>   
> after working with a camel for some months I wondered from time to time if 
> there is a possibility to define endpoints a bit more typesafe way because 
> writing URI strings is prone to typos/property-mismatch and (imho) not 
> really supported by an IDE. 
> Furthermore the developing includes writing code, reading the doc to get 
> that property's name and pasting it in the code. 
>   
> As I didn't find anything like that except 
> (http://camel.465427.n5.nabble.com/Endpoint-URI-typesafety-td5733594.htm), I 
> had an idea to write the consumer config as the following file copy example 
> demonstrates. 
>   
> (adapted from the camel in action book example in chapter 1): 
>   
> *from(new FileConsumerTemplate("data/inbox") 
> .setNoop(true) 
> .setRecursive(true) 
> .get()) 
>   
> .log("going to copy file..") 
> .to("file:data/outbox");* 
>   
> This way one could use endpoint specific template classes which implement 
> methods for the specific properties (enabling IDE auto suggestion) where one 
> could also put the camel documentation at.   
>   
> Have a look at the complete working example code (quickly hacked so there 
> are surely some points to optimize.) 
>   
> http://pastebin.com/JvMQ3wpG
> http://pastebin.com/Vn3z3sRc
> http://pastebin.com/Zjs3Jrp3
> (Alternatively the complete package in a zip: 
> https://dl.dropboxusercontent.com/u/34369176/typesafeProdCons.zip) 
>   
> Tell/write me what you think please . 
>   
>   
>   
>   
> -- 
> View this message in context: http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com). 




________________________________
 
If you reply to this email, your message will be added to the discussion below:http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391p5743397.html 
To unsubscribe from typesafe endpoint configuration approach, click here.
NAML



--
View this message in context: http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391p5743407.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: typesafe endpoint configuration approach

Posted by Willem jiang <wi...@gmail.com>.
Hi,  

I’m not a not a big fan of this type safe endpoint configuration.

As the endpoints are different from each other, you cannot define a unified fluent API for all the endpoints.
But Camel does support to define the Endpoint in the pure Java way, but it is not as easy as using the URI to setup the endpoint.

BTW, the good part of URI is we can build the endpoint from Java, Spring or Blueprint without change any thing.  

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Sunday, November 17, 2013 at 8:10 PM, ChristianSchaefer wrote:

> Hello there,
>  
> after working with a camel for some months I wondered from time to time if
> there is a possibility to define endpoints a bit more typesafe way because
> writing URI strings is prone to typos/property-mismatch and (imho) not
> really supported by an IDE.
> Furthermore the developing includes writing code, reading the doc to get
> that property's name and pasting it in the code.
>  
> As I didn't find anything like that except
> (http://camel.465427.n5.nabble.com/Endpoint-URI-typesafety-td5733594.htm), I
> had an idea to write the consumer config as the following file copy example
> demonstrates.
>  
> (adapted from the camel in action book example in chapter 1):
>  
> *from(new FileConsumerTemplate("data/inbox")
> .setNoop(true)
> .setRecursive(true)
> .get())
>  
> .log("going to copy file..")
> .to("file:data/outbox");*
>  
> This way one could use endpoint specific template classes which implement
> methods for the specific properties (enabling IDE auto suggestion) where one
> could also put the camel documentation at.  
>  
> Have a look at the complete working example code (quickly hacked so there
> are surely some points to optimize.)
>  
> http://pastebin.com/JvMQ3wpG
> http://pastebin.com/Vn3z3sRc
> http://pastebin.com/Zjs3Jrp3
> (Alternatively the complete package in a zip:
> https://dl.dropboxusercontent.com/u/34369176/typesafeProdCons.zip)
>  
> Tell/write me what you think please .
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/typesafe-endpoint-configuration-approach-tp5743391.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).