The DirectProducer is used, if you send an exchange to "direct:xxx". Your CreateAssetsProcessor use the producer template and send an exchange to the direct endpoint. Does you have a consumer listing on this endpoint?
And you should create the producer template from the incoming exchange: exchange.getContext().createProducerTemplate()... By the way, us routeId(...) instead of id(...). Best, Christian On Fri, Apr 27, 2012 at 8:22 PM, Danny <dannygallagh...@gmail.com> wrote: > Try to implement a few routes, one that picks up a file from a directory > and > one that sends a request to an external webservice. > > I have the following routes defined in java dsl > > from("file://in").id("file2jms").to("jms:ingest"); > > from("jms:ingest").id("ingestJms2Cxf").process(new > CreateAssetsProcessor()).to("cxf:bean:createAssetsEndpoint"); > > I'm packaging as osgi and deploying on servicemix, everything seems to > deploy fine. > > I drop a file into the in directory, the file itself doesn't matter, I'm > just using it as a trigger ,a message > is put on the queue, then when my processor class attempts to call the > service I get > > DirectProducer | 91 - org.apache.camel.camel-core - 2.8.4 > | No consumers available on endpoint: > Endpoint[direct://createAssetsEndpoint] to process: > Exchange[JmsMessage[JmsMessageID: > ID:dgallagher-dt-52023-1335533486191-2:31:1:1:1]] > > Which I think is that my processor class cannot connect to the web service > endpoint that I have running on my local tomcat, the service responds > correctly using soapui. > > the process method looks like this: > > final List<String> params = new ArrayList<String>(); > params.add("4"); > > Map hdrs = exchange.getIn().getHeaders(); > LOG.info( "HEADERS " + hdrs ); > > exchange.getIn().setBody(params); > exchange.getIn().setHeader("numberToDouble", "CreateAssetsService"); > > Exchange responseExchange = new > > DefaultCamelContext().createProducerTemplate().send("direct:createAssetsEndpoint", > exchange); > > org.apache.camel.Message out = responseExchange.getOut(); > > MessageContentsList result = (MessageContentsList)out.getBody(); > LOG.info("MESSSAGE FROM WEB SERVICE: " + result.get(0)); > > > Right now the responseExchange.getOut() gives a null pointer exception. > I'm > fuzzy on exactly what the parameters to setHeader and send are supposed to > be set to. > > I'm new to camel, in this role the processor is essentially serving as the > client for the call to my external web service. Is that a fair statement? > At this point all that I was trying to accomplish was to see the correct > result from the web service appear in the log. Any help or pointers > appreciated. > > Cheers > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/DirectProducer-no-consumers-available-on-endpoint-tp5671126p5671126.html > Sent from the Camel - Users mailing list archive at Nabble.com. >