Hello everybody!

Because we have to transfer large files from ftp server that caused
outOfMemory exceptions I have read that the ftp component option
*localWorkDirectory *can remedy this.

However could anybody please explain me why now some downloaded files via
ftp: component and option *localWorkDirectory *could not be saved randomly
into the final directory? There must be a logical reasoning in the camel
route for that failure.


Here comes the route:

from(ftp://00010@mecsoc-vm28/?noop=true&startingDirectoryMustExist=true&;
      
sendEmptyMessageWhenIdle=true&maximumReconnectAttempts=4&reconnectDelay=10000&
      
binary=true&password=?76Hko*fPQ&localWorkDirectory=c:/temp&filter=#imageFileFilter).routeId(routeId)
      .onException(Exception.class).handled(true)
        .to("log:errorLog?level=ERROR&showAll=true&multiline=true")
        .setHeader(DN1CamelHeader.ANY_MESSAGE, constant("Error occured while " +
                        "transfer was in progress!"))
        .bean(transferPayloads, "payloadTransferFailure")
        .to("activemq:topic:" + JmsDestinations.TOPIC_DASHBOARD_AUDITLOG)
        .setBody(exceptionMessage())
        .bean(stopRoute)
      .end()
      .onCompletion()
        .setHeader(DN1CamelHeader.TRANSFER_PAYLOAD_TYPE, constant("STATUS"))
        .to("seda:" + SedaDirectDestinations.SEDA_INFOS_WHILE_TRANSFER)
        .choice()
           .when(header("CamelBatchComplete").isEqualTo(Boolean.TRUE))
                .setHeader(DN1CamelHeader.TRANSFER_PAYLOAD_TYPE, 
constant("COMPLETE"))
                .setHeader(DN1CamelHeader.ANY_MESSAGE, simple("${header." + 
                    DN1CamelHeader.TRANSFER_TYPE +  "} transfer
completed!"))
                .to("seda:" + SedaDirectDestinations.SEDA_INFOS_WHILE_TRANSFER)
                .bean(stopRoute)
          .end()
        .end()
        .setHeader(DN1CamelHeader.PRODUCTION, constant(production))
        .setHeader(DN1CamelHeader.PROCESS, constant(process))
        .setHeader(DN1CamelHeader.TRANSFER_TYPE, constant(dataType))
        .choice()
                .when(body().isNull())
                        .setHeader(DN1CamelHeader.TRANSFER_PAYLOAD_TYPE, 
constant("COMPLETE"))
                        .setHeader(DN1CamelHeader.ANY_MESSAGE, 
                               simple("Directory is empty and transfer is
going to finish!"))
                        .to("seda:" + 
SedaDirectDestinations.SEDA_INFOS_WHILE_TRANSFER)
                        .bean(stopRoute)
                .otherwise()
                        .choice()
                                
.when(header("CamelBatchIndex").isEqualTo(Integer.valueOf(0)))
                                
.setHeader(DN1CamelHeader.TRANSFER_PAYLOAD_TYPE, constant("OVERVIEW"))
                                .to("seda:" + 
SedaDirectDestinations.SEDA_INFOS_WHILE_TRANSFER)
                        .end()
                                
.setHeader(DN1CamelHeader.TRANSFER_PAYLOAD_TYPE, constant("FILE"))
                                .to("seda:" + 
SedaDirectDestinations.SEDA_INFOS_WHILE_TRANSFER)
                                .to("file:" + receiptDir)
        .end();

Inside the log file I can explore the following stacktrace:

org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: c:\dn1\inputDir\010.exe
        at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:246)[118:org.apache.camel.camel-core:2.10.0]
        at
org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:249)[118:org.apache.camel.camel-core:2.10.0]
        at
org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:151)[118:org.apache.camel.camel-core:2.10.0]
Caused by: org.apache.camel.InvalidPayloadException: No body available of
type: java.io.InputStream but has value: GenericFile[010.exe] of type:
org.apache.camel.component.file.remote.RemoteFile on: 010.exe. Caused by:
Error during type conversion from type: java.io.File to the required type:
java.io.InputStream with value c:\temp\010.exe due
java.io.FileNotFoundException: c:\temp\010.exe (Das System kann die
angegebene Datei nicht finden). Exchange[010.exe]. Caused by:
[org.apache.camel.TypeConversionException - Error during type conversion
from type: java.io.File to the required type: java.io.InputStream with value
c:\temp\010.exe due java.io.FileNotFoundException: c:\temp\010.exe (Das
System kann die angegebene Datei nicht finden)]
        at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)[118:org.apache.camel.camel-core:2.10.0]
        at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:237)[118:org.apache.camel.camel-core:2.10.0]
        ... 70 more
Caused by: org.apache.camel.TypeConversionException: Error during type
conversion from type: java.io.File to the required type: java.io.InputStream
with value c:\temp\010.exe due java.io.FileNotFoundException:
c:\temp\010.exe (Das System kann die angegebene Datei nicht finden)
        at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:126)[118:org.apache.camel.camel-core:2.10.0]
        at
org.apache.camel.core.osgi.OsgiTypeConverter.convertTo(OsgiTypeConverter.java:102)[120:org.apa


Thanks
Hilde






--
View this message in context: 
http://camel.465427.n5.nabble.com/ftp-with-option-localWorkDirectory-tp5718783.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to