Camel用于路由外部REST Web服务

时间:2017-08-29 12:56:35

标签: spring-mvc apache-camel

我正在使用spring MVC并使用Apache camel来集成外部服务。 我想使用Apache Camel路由进行Webservice调用。

就像我的本地REST服务(http://localhostsmiliex.xx:8080/users)从外部REST服务(http://xxx:000/users)获取数据一样,并希望路由获取外部数据。

哪种Apache组件适用于Web服务路由,例如Jetty或生产者模板?

2 个答案:

答案 0 :(得分:0)

您是否尝试过HTTP4或HTTP? http://camel.apache.org/http4.html

答案 1 :(得分:0)

使用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>");
相关问题