apache camel - DirectConsumerNotAvailableException using endpointUri -


org.apache.camel.component.direct.directconsumernotavailableexception: no consumers available on endpoint: endpoint[direct://start]

i error above when try following code.

public static void main(string args[]) throws exception {     camelcontext context = new defaultcamelcontext();     producertemplate template = context.createproducertemplate();     consumertemplate consumer = context.createconsumertemplate();     consumer.start();     string response = ioutils.tostring(new fileinputstream(args[0]));     template.sendbody("direct:start", response);     exchange out = consumer.receive("direct:start");     thread.sleep(10000);     consumer.stop(); } 

but works when tried below

    public static void main(string args[]) throws exception {     camelcontext context = new defaultcamelcontext();     final dataformat dataformat = new bindycsvdataformat(ttlabsresponse.class);      routebuilder rb = new routebuilder() {         public void configure() {             from("file://src/test/resources?noop=true&filename=tsv.txt")             .unmarshal(dataformat).process(new simpleprocessor());         }     };     context.addroutes(rb);     context.start();     thread.sleep(10000);     context.stop(); } 

in first not have route consumes direct:start endpoint , why error when try send message direct endpoint has no consumer.

the direct endpoint direct method invocation , requires consumer.

you can send seda instead using queue decouple producer , consumer.

see more at


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -