Apache Camel : “direct:start” endpoint - what does it mean ?

前端 未结 7 689
既然无缘
既然无缘 2021-02-02 05:38

I\'m new to Apache Camel. Can someone explain what \"direct:start\" means in Camel. Please see

http://camel.apache.org/http

from(\"direct:start\")
.to(         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 06:20

    The "direct:start" above is simply saying that the route starts with a Direct Component named "start".

    The direct endpoint provides synchronous invocation of a route. If you want to send an Exchange to the direct:start endpoint you would create a ProducerTemplate and use the various send methods.

    ProducerTemplate template = context.createProducerTemplate();
    
    template.sendBody("direct:start", "This is a test message");
    

    There is nothing special about the name start. It is simply the name you are going to use when referring to the endpoint and could have just as easily been direct:foo.

提交回复
热议问题