Thank you for your help it works now. If someone is interested in the
solution, here it is:

1) I updated to Camel version 2.10-Snapshot (to use the
consumer.bridgeErrorHandler=true option)
2) implemented my own PollingConsumerPollStrategy which forwards Exceptions
to the Camel route:

public class EmptyMessagePollingStrategy implements
                org.apache.camel.spi.PollingConsumerPollStrategy {
        
        public boolean begin(Consumer arg0, Endpoint arg1) {
                return true;
        }

        public void commit(Consumer arg0, Endpoint arg1, int arg2) {
        }

        /**
         * If an Exception occurs forward it to the Camel route
         */
        public boolean rollback(Consumer consumer, Endpoint endpoint, int arg2,
Exception e)
                        throws Exception {
                throw e;
        }
}

3) registered the strategy at the registry

SimpleRegistry registry = new SimpleRegistry();
registry.put("myPollStrategy", new EmptyMessagePollingStrategy());
context = new DefaultCamelContext(registry);

4) set the strategy in the route with pollStrategy=#myPollStrategy

5) the route code (EmptyMessageGenerator generates the emptyMessage and the
callbackProcessor relies on the empty message)

onException(org.apache.camel.component.file.GenericFileOperationFailedException.class)
        .process(new EmptyMessageGenerator()).process(callbackProcessor)
        .handled(true);
from(from_uri).routeId(routeId).autoStartup(false).process(callbackProcessor)
        .to(to_uri);



--
View this message in context: 
http://camel.465427.n5.nabble.com/Changing-from-file-consumer-to-ftp-consumer-tp5715125p5715224.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to