- Apache Camel Developer's Cookbook
- Scott Cranton Jakub Korab
- 123字
- 2021-07-19 18:46:35
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) //...
推薦閱讀
- OpenStack Cloud Computing Cookbook(Third Edition)
- MATLAB圖像處理超級學(xué)習(xí)手冊
- 簡單高效LATEX
- 青少年P(guān)ython編程入門
- D3.js 4.x Data Visualization(Third Edition)
- Python Web數(shù)據(jù)分析可視化:基于Django框架的開發(fā)實(shí)戰(zhàn)
- 青少年信息學(xué)競賽
- Hands-On Nuxt.js Web Development
- Building Serverless Architectures
- Django 5企業(yè)級Web應(yīng)用開發(fā)實(shí)戰(zhàn)(視頻教學(xué)版)
- DevOps 精要:業(yè)務(wù)視角
- Spark技術(shù)內(nèi)幕:深入解析Spark內(nèi)核架構(gòu)設(shè)計(jì)與實(shí)現(xiàn)原理
- Less Web Development Cookbook
- Java EE輕量級解決方案:S2SH
- Spring Boot 2+Thymeleaf企業(yè)應(yīng)用實(shí)戰(zhàn)