Friday, October 02, 2015

Apache Camel is a great project i've been using for creating real great integrations with. The online documentation is fairly good, but as with many projects it's missing some updates. I hit a problem with using Camel and CDI. I couldn't get any of the examples for the ProducerTemplate to work, that's because the documentation uses Spring DI instead of the Java EE CDI implementation. I couldn't find anything on the Camel site that explains how to do it with CDI, so if you're having the same problems (NPE will be thrown each time your producer is used), the following works:

    @Inject
    @Uri("mock:ToAnEndPoint")
    ProducerTemplate producer;



No comments: