camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ekz <ekizo...@gmail.com>
Subject FTP Reconnect attempt problem
Date Wed, 08 Apr 2015 07:04:18 GMT
Hi,
I have a route as below. My problem is about reconnect attempts.
I am waiting 1 min for the next poll from ftp with the parameter
"consumer.delay=60000" that is ok, but if the connection fails, expecting 2
min wait before next connection attempt but 
below code is still using 1 min delay for the next connection attempt. 
How can i achive this?
(camel version: 2.14.0)

from("sftp://user@host:port/?password=pw"
                                + "&*consumer.delay=60000*"
                                + "&passiveMode=true"
                                + "&consumer.bridgeErrorHandler=true"
                                + "&throwExceptionOnConnectFailed=true"
                                + "&maximumReconnectAttempts=0"
                                + "&*reconnectDelay=120000*" //reconnect
attempt every 2 min
                                + "&pollStrategy=#customPollStrategy")
.log("consuming file from ftp : ${headers.CamelFileName}");

and my custom poll strategy is as foolws:

public class CustomPollStrategy extends
RemoteFilePollingConsumerPollStrategy {

    @Override
    public synchronized boolean rollback(Consumer consumer, Endpoint
endpoint, int retryCounter, Exception cause) throws Exception {

        //retry 3 times
        if(retryCounter <= 2) {
            //force disconnect
            super.rollback(consumer, endpoint, retryCounter, cause);            
            return true;
        }
        else {
            //give up retry and wait for the next connection attempt.
			return false;
        }        
    }
}



--
View this message in context: http://camel.465427.n5.nabble.com/FTP-Reconnect-attempt-problem-tp5765466.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message