0
votes

I'm working on spring MVC and using Apache camel to integrate external services. I wanted to use Apache Camel route to make a Webservice call.

Like my local REST service (http://localhostsmiliex.xx:8080/users) fetching data from external REST service (http://xxx:000/users) and wanted routing to fetch external data.

Which Apache component would be suitable for a web-service route such as Jetty or producer template?

2

2 Answers

0
votes
0
votes

Use ProducerTemplate, it works like a charm for calling external endpoints REST, DB, SOAP etc..

You can either autowire it

@Autowired
ProducerTempalete prodcuerTemplate
prodcuerTemplate.sendBody("http://xyz...", "<hello>world!</hello>"); 

or

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>");