骆驼路由外部REST Web服务
问题描述:
我正在使用Spring MVC并使用Apache骆驼来集成外部服务。 我想使用Apache Camel路由来进行Web服务调用。骆驼路由外部REST Web服务
就像我的本地REST服务(http://localhostsmiliex.xx:8080/users)从外部REST服务(http://xxx:000/users)获取数据并希望路由获取外部数据。
哪个Apache组件适用于Web服务路由,如Jetty或生产者模板?
答
使用ProducerTemplate,它就像一个魅力调用外部端点REST,DB,SOAP等。
您可以自动装配它
@Autowired
ProducerTempalete prodcuerTemplate
prodcuerTemplate.sendBody("http://xyz...", "<hello>world!</hello>");
或
ProducerTemplate template = exchange.getContext().createProducerTemplate();
// send to default endpoint
template.sendBody("<hello>world!</hello>");
// send to a specific queue
template.sendBody("http://xyz...", "<hello>world!</hello>");
谢谢你是gogic。如果我以这种方式路由,从我的应用程序路由器中的(“direct:start”)。到(“http://services.groupkt.com/country/get/all”)不会触发Spring MVC应用程序。 – DevD