I have a requirement where I need to call a specific logic before calling a SFTP endpoint. The logic in consideration will inject some headers in exchange. Those headers will then be used when SFTP route starts.
So I am trying to invoke my initial setup logic at the tick of first timer. And it will run only once. Some headers will be set inside exchange object. Then after this is finished file endpoint should be called. Headers should flow through the exchange object passed between these endpoint.
I tried exploring direct component for this. I tried something like this
from("timer://cacheEntryCount?repeatCount=1")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception
{
logger.info("setting count");
exchange.getIn().setHeader("count",1);
}
})
.to("direct:"+fileUrl);
from("direct:"+fileUrl)
....
....
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception
{
logger.info("accessing count");
exchange.getIn().getHeader("count");
}
....
Where fileUrl=file:/tmp/refDataFiles?charset=UTF-8
But this gives me below error
Failed to resolve endpoint: direct://file:/temp/refDataFiles?charset=UTF-8 due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{charset=UTF-8}]
How to proceed here? Please help.