You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "omar attari (JIRA)" <ji...@apache.org> on 2016/01/13 16:51:40 UTC

[jira] [Commented] (CAMEL-9512) camel-ftp - Recover from lost connection issue

    [ https://issues.apache.org/jira/browse/CAMEL-9512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15096379#comment-15096379 ] 

omar attari commented on CAMEL-9512:
------------------------------------

commConfig.properties file we are useing:

reload.comm.config.period.ms=60000
number.of.service.executors=100
wsdl.file.location=
file.responses.pull.period=60000
ftp.maximum.reconnect.attempts=3
ftp.reconnect.delay=30000
agent.id=agent2500
disconnect.route=true

> camel-ftp - Recover from lost connection issue
> ----------------------------------------------
>
>                 Key: CAMEL-9512
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9512
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sftp
>    Affects Versions: 2.14.1
>            Reporter: omar attari
>
> Dears,
> we are using the sftp camel route but in daily bases for unknown reasons ths sftp camel servise was stop polling any file from sftp server but when close the service and reopen it the problem not happend again in this day and this is my code :
> package com.progressoft.jfw.model.opay.ftp.camel;
> import com.progressoft.jfw.model.opay.comm.properties.PropertiesLoader;
> import java.text.MessageFormat;
> import org.apache.camel.LoggingLevel;
> import org.apache.camel.builder.ExpressionClause;
> import org.apache.camel.builder.LoggingErrorHandlerBuilder;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.model.ProcessorDefinition;
> import org.apache.camel.model.RouteDefinition;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> public class SftpRoutesBuilder
>   extends RouteBuilder
> {
>   private static final Logger LOGGER = LoggerFactory.getLogger(SftpRoutesBuilder.class);
>   private String protocol;
>   private String username;
>   private String password;
>   private String requestUri;
>   private String inProcessUri;
>   private boolean passiveMode;
>   private boolean binary;
>   private String routeId;
>   private String fileOwnerBicCode;
>   private String filePurpose;
>   private String privateKey;
>   private String privateKeyPassphrase;
>   
>   public void configure()
>     throws Exception
>   {
>     LOGGER.info("configuring the ftp routes builder");
>     
>     errorHandler(loggingErrorHandler(LOGGER).level(LoggingLevel.INFO));
>     if ((this.privateKey != null) && (this.password != null) && (this.privateKeyPassphrase == null)) {
>       ((RouteDefinition)((RouteDefinition)((RouteDefinition)((ProcessorDefinition)((ProcessorDefinition)((ProcessorDefinition)from(MessageFormat.format("{0}://{1}@{2}?password={3}&passiveMode={4}&binary={5}&privateKey={6}", new Object[] { this.protocol, this.username, this.requestUri, this.password, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey }) + "&delay=60000&delete=true&" + "maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route")).setProperty("fileName").simple("CamelFileName")).setProperty("fileOwnerBicCode").simple(this.fileOwnerBicCode)).setProperty("filePurpose").simple(this.filePurpose)).to(MessageFormat.format("{0}://{1}@{2}?password={3}&passiveMode={4}&binary={5}&privateKey={6}", new Object[] { this.protocol, this.username, this.inProcessUri, this.password, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey }) + "&maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route"))).convertBodyTo(byte[].class)).process(new FtpFilesProcessor())).routeId(this.routeId);
>     } else if ((this.privateKey != null) && (this.password == null) && (this.privateKeyPassphrase == null)) {
>       ((RouteDefinition)((RouteDefinition)((RouteDefinition)((ProcessorDefinition)((ProcessorDefinition)((ProcessorDefinition)from(MessageFormat.format("{0}://{1}@{2}?passiveMode={3}&binary={4}&privateKey={5}", new Object[] { this.protocol, this.username, this.requestUri, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey }) + "&delay=60000&delete=true&" + "maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route")).setProperty("fileName").simple("CamelFileName")).setProperty("fileOwnerBicCode").simple(this.fileOwnerBicCode)).setProperty("filePurpose").simple(this.filePurpose)).to(MessageFormat.format("{0}://{1}@{2}?passiveMode={3}&binary={4}&privateKey={5}", new Object[] { this.protocol, this.username, this.inProcessUri, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey }) + "&maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route"))).convertBodyTo(byte[].class)).process(new FtpFilesProcessor())).routeId(this.routeId);
>     } else if ((this.privateKey == null) && (this.password != null) && (this.privateKeyPassphrase == null)) {
>       ((RouteDefinition)((RouteDefinition)((RouteDefinition)((ProcessorDefinition)((ProcessorDefinition)((ProcessorDefinition)from(MessageFormat.format("{0}://{1}@{2}?password={3}&passiveMode={4}&binary={5}", new Object[] { this.protocol, this.username, this.password, this.requestUri, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary) }) + "&delay=60000&delete=true&" + "maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route")).setProperty("fileName").simple("CamelFileName")).setProperty("fileOwnerBicCode").simple(this.fileOwnerBicCode)).setProperty("filePurpose").simple(this.filePurpose)).to(MessageFormat.format("{0}://{1}@{2}?password={3}&passiveMode={4}&binary={5}", new Object[] { this.protocol, this.username, this.password, this.inProcessUri, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary) }) + "&maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route"))).convertBodyTo(byte[].class)).process(new FtpFilesProcessor())).routeId(this.routeId);
>     } else if ((this.privateKey != null) && (this.password == null) && (this.privateKeyPassphrase != null)) {
>       ((RouteDefinition)((RouteDefinition)((RouteDefinition)((ProcessorDefinition)((ProcessorDefinition)((ProcessorDefinition)from(MessageFormat.format("{0}://{1}@{2}?passiveMode={3}&binary={4}&privateKey={5}&privateKeyPassphrase={6}", new Object[] { this.protocol, this.username, this.requestUri, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey, this.privateKeyPassphrase }) + "&delay=60000&delete=true&" + "maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route")).setProperty("fileName").simple("CamelFileName")).setProperty("fileOwnerBicCode").simple(this.fileOwnerBicCode)).setProperty("filePurpose").simple(this.filePurpose)).to(MessageFormat.format("{0}://{1}@{2}?passiveMode={3}&binary={4}&privateKey={5}&privateKeyPassphrase={6}", new Object[] { this.protocol, this.username, this.inProcessUri, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey, this.privateKeyPassphrase }) + "&maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route"))).convertBodyTo(byte[].class)).process(new FtpFilesProcessor())).routeId(this.routeId);
>     } else if ((this.privateKey != null) && (this.password != null) && (this.privateKeyPassphrase != null)) {
>       ((RouteDefinition)((RouteDefinition)((RouteDefinition)((ProcessorDefinition)((ProcessorDefinition)((ProcessorDefinition)from(MessageFormat.format("{0}://{1}@{2}?password={3}&passiveMode={4}&binary={5}&privateKey={6}&privateKeyPassphrase={7}", new Object[] { this.protocol, this.username, this.requestUri, this.password, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey, this.privateKeyPassphrase }) + "&delay=60000&delete=true&" + "maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route")).setProperty("fileName").simple("CamelFileName")).setProperty("fileOwnerBicCode").simple(this.fileOwnerBicCode)).setProperty("filePurpose").simple(this.filePurpose)).to(MessageFormat.format("{0}://{1}@{2}?password={3}&passiveMode={4}&binary={5}&privateKey={6}&privateKeyPassphrase={7}", new Object[] { this.protocol, this.username, this.inProcessUri, this.password, Boolean.valueOf(this.passiveMode), Boolean.valueOf(this.binary), this.privateKey, this.privateKeyPassphrase }) + "&maximumReconnectAttempts=" + PropertiesLoader.getInstance().getPropertyValue("ftp.maximum.reconnect.attempts") + "&reconnectDelay=" + PropertiesLoader.getInstance().getPropertyValue("ftp.reconnect.delay") + "&disconnect=" + PropertiesLoader.getInstance().getPropertyValue("disconnect.route"))).convertBodyTo(byte[].class)).process(new FtpFilesProcessor())).routeId(this.routeId);
>     }
>   }
>   
>   public SftpRoutesBuilder(String protocol, String username, String password, String requestUri, String inProcessUri, boolean passiveMode, boolean binary, String routeId, String fileOwnerBicCode, String filePurpose, String privateKey, String passPhrase)
>   {
>     this.protocol = protocol.toLowerCase();
>     this.username = username;
>     this.password = password;
>     this.requestUri = requestUri;
>     this.inProcessUri = inProcessUri;
>     this.passiveMode = passiveMode;
>     this.binary = binary;
>     this.routeId = routeId;
>     this.fileOwnerBicCode = fileOwnerBicCode;
>     this.filePurpose = filePurpose;
>     this.privateKey = privateKey;
>     this.privateKeyPassphrase = passPhrase;
>   }
>   
>   public SftpRoutesBuilder(String transferMethod, String username2, String password2, String requestUri2, String inProccessUri, String routeId, String fileOwnerBicCode, String filePurpose, String privateKey, String passPhrase)
>   {
>     this.protocol = transferMethod.toLowerCase();
>     this.username = username2;
>     this.password = password2;
>     this.requestUri = requestUri2;
>     this.inProcessUri = inProccessUri;
>     this.passiveMode = Boolean.TRUE.booleanValue();
>     this.binary = Boolean.TRUE.booleanValue();
>     this.routeId = routeId;
>     this.fileOwnerBicCode = fileOwnerBicCode;
>     this.filePurpose = filePurpose;
>     this.privateKey = privateKey;
>     this.privateKeyPassphrase = passPhrase;
>   }
>   
>   public SftpRoutesBuilder(String transferMethod, String username2, String password2, String requestUri2, String inProccessUri, String routeId, String fileOwnerBicCode, String filePurpose)
>   {
>     this.protocol = transferMethod.toLowerCase();
>     this.username = username2;
>     this.password = password2;
>     this.requestUri = requestUri2;
>     this.inProcessUri = inProccessUri;
>     this.passiveMode = Boolean.TRUE.booleanValue();
>     this.binary = Boolean.TRUE.booleanValue();
>     this.routeId = routeId;
>     this.fileOwnerBicCode = fileOwnerBicCode;
>     this.filePurpose = filePurpose;
>     this.privateKey = null;
>   }
> }
> from sftp file builder class



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)