camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: No consumers available on endpoint exception?
Date Thu, 15 Dec 2011 07:41:26 GMT
Hi,

You are using too much low level API such as endpoint.createExchange(), 
endpoint.createProducer.

Why don't you use the camel-test support class to write a unit test ?

Willem

On 12/15/11 3:11 PM, xiangqiuzhao wrote:
>          MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
>          JmsConfiguration jc = new JmsConfiguration(cf);
>
>          cf.setHostName("172.16.16.136");
>          cf.setPort(1416);
>          cf.setQueueManager("QM2");
>          cf.setChannel("BTOA");
>          cf.setTransportType(1);
>
>          JmsComponent ibmmq = new JmsComponent(jc);
>          ibmmq.setAcknowledgementModeName("AUTO_ACKNOWLEDGE");
>
>          CamelContext camel = new DefaultCamelContext();
>          camel.addComponent("ibmmq", ibmmq);
>
>          camel.addRoutes(new RouteBuilder() {
>              public void configure() {
>                  from("direct:test").to("ibmmq:QRB");
>              }
>          });
>
>          Endpoint endpoint = camel.getEndpoint("direct:test");
>          Exchange exchange = endpoint.createExchange();
>          String data = "send something";
>          Producer producer = endpoint.createProducer();
>          exchange.getIn().setBody(data);
>          producer.process(exchange);
>          System.out.println(new String((byte[])exchange.getOut().getBody()));
>
>
> Exception in thread "main" org.apache.camel.CamelExchangeException: No
> consumers available on endpoint: Endpoint[direct://test]. Exchange[Message:
> send something]
> 	at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:46)
> 	at com.sunyard.camel.TestJmsComponent.main(TestJmsComponent.java:51)
>
>
> where is wrong in my program?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/No-consumers-available-on-endpoint-exception-tp5076708p5076708.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message