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.

Reply via email to