2008/10/10 cmoulliard <[EMAIL PROTECTED]>: > Hi, > > I have a quick question. Can I use @annotation to create a java class (which > is not a TEST class) where I would like to start camelcontext, add endpoints > and routes ? > > If the answer is yes, where can I find an example in camel-source ? > > Is there an annotation to define routes ?
You can create a RouteBuilder and have a spring.xml instantiate it (either using component scanning or explicitly defining it in your spring XML). There's currently no way to create/instantiate a CamelContext via an annotation though; it has to be done via the spring.xml right now. Though if you implement CamelContextAware it'll be injected into your bean if you want it. You can then route endpoints using the Java DSL and either using URIs to endpoints or injecting endpoints into your bean http://activemq.apache.org/camel/bean-injection.html Another approach if you have simple routes is to use POJO based consuming or producing http://activemq.apache.org/camel/pojo-consuming.html http://activemq.apache.org/camel/pojo-producing.html there are some routing annotations too - e.g. http://activemq.apache.org/camel/recipientlist-annotation.html -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com
