* @param exchange the current exchange
*/
protected void preChceckPoll(Exchange exchange) throws Exception {
// cannot poll a file endpoint if already consuming from a file endpoint (CAMEL-1895)
if (consumer instanceof EventDrivenPollingConsumer) {
EventDrivenPollingConsumer edpc = (EventDrivenPollingConsumer) consumer;
boolean fileBasedConsumer = edpc.getEndpoint().getEndpointKey().startsWith("file") || edpc.getEndpoint().getEndpointKey().startsWith("ftp");
boolean fileBasedExchange = exchange.getFromEndpoint() != null
&& (exchange.getFromEndpoint().getEndpointUri().startsWith("file") || exchange.getFromEndpoint().getEndpointUri().startsWith("ftp"));
if (fileBasedConsumer && fileBasedExchange) {
throw new IllegalArgumentException("Camel currently does not support pollEnrich from a file/ftp endpoint"
+ " when the route also started from a file/ftp endpoint."
+ " Started from: " + exchange.getFromEndpoint().getEndpointUri() + " pollEnrich: " + edpc.getEndpoint().getEndpointUri());
}
}
}