Hi Check this example http://camel.apache.org/pojo-messaging-example.html
Which is also included with source code in the Camel distribution. On Wed, Oct 19, 2011 at 5:22 PM, Mark Webb <[email protected]> wrote: > I am looking at the pojo-producing documentation, and I don't see how > to inject the right information into my class. I have this as a test > class: > > import org.apache.camel.InOnly; > import org.apache.camel.Produce; > > public class DummyPackageProducerBean { > > @Produce(uri="seda:sendstuffhere") > protected DummyInterface producer; > > public void whatever(){ > > producer.sendPackage("Hello World"); > } > } > > @InOnly > interface DummyInterface { > > public void sendPackage( String name ); > } > > When I run my code which loads the camel context file using a > FileSystemXmlApplicationContext, I get the following exception: > > Exception in thread "main" java.lang.NullPointerException > at > com.xxx.camel.filter.engine.producer.DummyPackageProducerBean.whatever(DummyPackageProducerBean.java:13) > at com.xxx.camel.filter.engine.DemoRoutes.main(DemoRoutes.java:25) > > > > > On Wed, Oct 19, 2011 at 10:27 AM, Claus Ibsen <[email protected]> wrote: >> Hi >> >> Yeah for #1 in the bean (eg in your java code) you can inject a Camel >> ProducerTemplate >> http://camel.apache.org/producertemplate.html >> >> And then from one line of code send the message into Camel. >> >> You can also use annotations like @Produce as well >> http://camel.apache.org/pojo-producing.html >> >> See details here also >> http://camel.apache.org/bean-integration.html >> >> >> On Wed, Oct 19, 2011 at 4:12 PM, Mick Knutson <[email protected]> wrote: >>> You could: >>> >>> >>> 1. Create a Bean that has a message Producer that sends a message to the >>> route >>> 2. You could also use CXF and then you could also get data from outside >>> your app in the future >>> >>> #1 is the simplest though. >>> >>> >>> --- >>> Thank You… >>> >>> Mick Knutson, President >>> >>> BASE Logic, Inc. >>> Enterprise Architecture, Design, Mentoring & Agile Consulting >>> p. (855) BASE-LOGIC: (227-3564-42) >>> p. (478) BASE-LOGIC (227-3564-42) >>> f. (855) BASE-LOGIC: (227-3564-42) >>> >>> Website: http://www.baselogic.com >>> Blog: http://www.baselogic.com/blog/ >>> Linked IN: http://linkedin.com/in/mickknutson >>> Twitter: http://twitter.com/mickknutson >>> --- >>> >>> >>> >>> On Wed, Oct 19, 2011 at 10:09 AM, Mark Webb <[email protected]> wrote: >>> >>>> I want to embed camel into an existing application in order to perform >>>> some message routing. The application processes data and I would like >>>> this data to then "enter" a camel route. The camel route will exist >>>> in the same VM as the application that is processing the data. What's >>>> the easiest way to get the data into the route? >>>> >>>> Thanks, >>>> Mark >>>> >>> >> >> >> >> -- >> Claus Ibsen >> ----------------- >> FuseSource >> Email: [email protected] >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ >> > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
