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 nicer 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 x's name  and pasting it in the code.

As I didn't find anything like that, 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)
                        .toString())

                    .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.

Reply via email to