You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Danny <da...@gmail.com> on 2012/04/27 20:22:54 UTC

DirectProducer - no consumers available on endpoint

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.

Re: DirectProducer - no consumers available on endpoint

Posted by Christian Müller <ch...@gmail.com>.
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 <da...@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.
>

Re: DirectProducer - no consumers available on endpoint

Posted by Willem Jiang <wi...@gmail.com>.
You can use ProducerTemplate.requestBody(...) to send the request.
And you can get the exception automatically.

On Sat Apr 28 10:27:28 2012, Danny wrote:
> Willem,
> Is there a higher level way to achieve the call?
> On Apr 27, 2012 10:04 PM, "Willem.Jiang [via Camel]"<
> ml-node+s465427n5671938h0@n5.nabble.com>  wrote:
>
>> Just one comments for why you got the NPE from the out message of the
>> exchange.
>>
>> As you are using a low level send API of the ProducerTemplate, you need
>> to check if the Exchange is failed before you try to access the response
>> message from the exchange.
>>
>>
>> On 4/28/12 2:22 AM, Danny 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.
>>> .
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>            http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>>
>> ------------------------------
>>   If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/DirectProducer-no-consumers-available-on-endpoint-tp5671126p5671938.html
>>   To unsubscribe from DirectProducer - no consumers available on endpoint, click
>> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5671126&code=ZGFubnlnYWxsYWdoZXIyQGdtYWlsLmNvbXw1NjcxMTI2fDQ3NzM3NjExNA==>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/DirectProducer-no-consumers-available-on-endpoint-tp5671126p5671951.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: DirectProducer - no consumers available on endpoint

Posted by Danny <da...@gmail.com>.
Willem,
Is there a higher level way to achieve the call?
On Apr 27, 2012 10:04 PM, "Willem.Jiang [via Camel]" <
ml-node+s465427n5671938h0@n5.nabble.com> wrote:

> Just one comments for why you got the NPE from the out message of the
> exchange.
>
> As you are using a low level send API of the ProducerTemplate, you need
> to check if the Exchange is failed before you try to access the response
> message from the exchange.
>
>
> On 4/28/12 2:22 AM, Danny 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.
> > .
> >
>
>
> --
> Willem
> ----------------------------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>           http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/DirectProducer-no-consumers-available-on-endpoint-tp5671126p5671938.html
>  To unsubscribe from DirectProducer - no consumers available on endpoint, click
> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5671126&code=ZGFubnlnYWxsYWdoZXIyQGdtYWlsLmNvbXw1NjcxMTI2fDQ3NzM3NjExNA==>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://camel.465427.n5.nabble.com/DirectProducer-no-consumers-available-on-endpoint-tp5671126p5671951.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: DirectProducer - no consumers available on endpoint

Posted by Willem Jiang <wi...@gmail.com>.
Just one comments for why you got the NPE from the out message of the 
exchange.

As you are using a low level send API of the ProducerTemplate, you need 
to check if the Exchange is failed before you try to access the response 
message from the exchange.


On 4/28/12 2:22 AM, Danny 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.
> .
>


-- 
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang