官术网_书友最值得收藏!

Reusing endpoints

When an endpoint is going to be used multiple times in a Camel context it is preferable to define it at a single place so that it is used consistently. This recipe will show you a way to do that.

Getting ready

Define your desired routing logic as described in either the Using Camel in a Java application recipe, or the Embedding Camel in a Spring application recipe.

How to do it...

In the XML DSL, define an <endpoint/> element with an id attribute and an uri attribute setting that is set to the URI value you wish to share:

<camelContext xmlns="...">
 <endpoint id="restfulOrdersService"
 uri="jetty:http://localhost:8080/orders"/>
  <route>
    <from ref="restfulOrdersService"/>
    <!-- ... -->
  </route>
</camelContext>

If using the Java DSL, simply define the URI as a String within RouteBuilder configure() method:

String restfulOrdersService =
    "jetty:http://localhost:8080/orders";

from(restfulOrdersService) //...
主站蜘蛛池模板: 安化县| 章丘市| 苏尼特右旗| 长泰县| 彭水| 江西省| 天峨县| 澄城县| 浦东新区| 墨竹工卡县| 浮山县| 金湖县| 滨海县| 团风县| 岚皋县| 新宁县| 平舆县| 会同县| 兰考县| 安丘市| 富裕县| 故城县| 波密县| 大邑县| 兴国县| 广灵县| 罗江县| 昌图县| 日土县| 黔江区| 吐鲁番市| 汉阴县| 邳州市| 泸西县| 邹平县| 张北县| 小金县| 安乡县| 八宿县| 澳门| 安塞县|