replace    producer.sendBody("direct:step1", "test message"); with

  producer.asyncSendBody("direct:step1", "test message");

and you don't need to start consumer manually( consumer.start();) as camel
does it automatically when ConsumerTemplate is created.

---------- Forwarded message ----------
From: trilochan237 <kartheektrilochan...@gmail.com>
Date: Tue, Nov 26, 2013 at 12:57 PM
Subject: Problem with consuming from endpoint
To: users@camel.apache.org


Hi,

I am facing an issue while consuming the data from an endpoint


*No consumers available on endpoint: Endpoint[direct://step2].
Exchange[Message: test message]*

I have gone through the link
http://camel.465427.n5.nabble.com/No-consumers-available-on-endpoint-exception-td5076708.html#a5076774
but couldn't able to solve my issue.

Please help me out in solving this issue.
Also please tell me how to consume the data from a bean which is acting as
an endpoint

Following is the code which i have written

public class SimpleConsumer {

        public static void main(String[] args) throws Exception {
                CamelContext context = new DefaultCamelContext();
                context.addRoutes(new RouteBuilder() {

                        @Override
                        public void configure() throws Exception {
                                from("direct:step1").process(new
Processor() {
                                        @Override
                                        public void process(Exchange
exchange) throws Exception {

System.out.println(exchange.getIn());
                                        }
                                }).to("direct:step2");

                        }
                });
                context.start();
                ProducerTemplate producer =
context.createProducerTemplate();
                ConsumerTemplate consumer =
context.createConsumerTemplate();
                producer.sendBody("direct:step1", "test message");
                consumer.start();
                System.out.println(consumer.receive("direct:step2"));
                consumer.stop();
                context.stop();

        }

}



--
View this message in context:
http://camel.465427.n5.nabble.com/Problem-with-consuming-from-endpoint-tp5743831.html
Sent from the Camel - Users mailing list archive at Nabble.com.



On Tue, Nov 26, 2013 at 12:57 PM, trilochan237 <
kartheektrilochan...@gmail.com> wrote:

> Hi,
>
> I am facing an issue while consuming the data from an endpoint
>
>
> *No consumers available on endpoint: Endpoint[direct://step2].
> Exchange[Message: test message]*
>
> I have gone through the link
>
> http://camel.465427.n5.nabble.com/No-consumers-available-on-endpoint-exception-td5076708.html#a5076774
> but couldn't able to solve my issue.
>
> Please help me out in solving this issue.
> Also please tell me how to consume the data from a bean which is acting as
> an endpoint
>
> Following is the code which i have written
>
> public class SimpleConsumer {
>
>         public static void main(String[] args) throws Exception {
>                 CamelContext context = new DefaultCamelContext();
>                 context.addRoutes(new RouteBuilder() {
>
>                         @Override
>                         public void configure() throws Exception {
>                                 from("direct:step1").process(new
> Processor() {
>                                         @Override
>                                         public void process(Exchange
> exchange) throws Exception {
>
> System.out.println(exchange.getIn());
>                                         }
>                                 }).to("direct:step2");
>
>                         }
>                 });
>                 context.start();
>                 ProducerTemplate producer =
> context.createProducerTemplate();
>                 ConsumerTemplate consumer =
> context.createConsumerTemplate();
>                 producer.sendBody("direct:step1", "test message");
>                 consumer.start();
>                 System.out.println(consumer.receive("direct:step2"));
>                 consumer.stop();
>                 context.stop();
>
>         }
>
> }
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-consuming-from-endpoint-tp5743831.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to