2009/5/22 EwanH <[email protected]>: > > How does one get a reference to the camelcontext
If your bean implements CamelContextAware it will be injected into you > when using a spring > ContextLoaderListener set in web.xml that configures a RouteBuilder using > package scanning? Below I have context that on start seems to boot up fine: > > <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> > <package>myapp.routes</package> > </camelContext> > > However I now want to create a ProducerTemplate from the context which I was > hoping would be via a factory method but can't find one. Any ideas? You should be able to just have one automatically injected into your class for you by using the @Produces annotation... http://camel.apache.org/pojo-producing.html or just create a producer template using the <template> element <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <package>myapp.routes</package> <template id="myTemplate"/> </camelContext> then look it up in Spring by id. My preferred approach is to have spring inject whatever it is you want (e.g. the ProducerTemplate) using the @Produces annotation. -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
