Im using FluentProducerTemplate to send some data into Camel route and getting back hardcoded string message "Hello". Now I want Camel route to return data from text or json file which is stored locally. I couldn't find in a documentation how route should return the file content. I assume it should be something as exchange.getIn().setBody(<declare path>) but Im not sure how to do/declare it. I would have that file in a project's IDE folder/package dataOut/data.txt.
@EndpointInject
private FluentProducerTemplate producer;
public String getDataFromRoute(Employee employee){
String strData = producer.withBody(employee)
.to("direct:invokeRoute")
.request(String.class);
return strData;
}
@Override
public void configure() throws Exception {
from("direct:invokeRoute")
.process(exchange -> {
exchange.getIn().setBody("Hallo")
});
}