camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: FTP Component Network Failure Recovery Problem
Date Thu, 16 Jul 2009 16:09:48 GMT
Hi

The FTP consumer is scheduled anyway, so you do not absolutely have to
use the maximumReconnectAttempts=-1.

You can remove these options and just use delay to set a time in
millis between each poll.
For instance setting delay=10000 will poll every 10th second and in
case of some network issue it will recover at next poll.

The maximumReconnectAttempts is mean to try to recover immediately
when for example the delay is very long, eg only polling once a day or
something.


On Thu, Jul 16, 2009 at 4:45 PM, Jason Queen<Jason.Queen@colinx.com> wrote:
>
> Hello,
> I've been testing with 2.0M2 and the Jul 14 SNAPSHOT.  I setup a simple loop
> test using 2 routes where camel is running on my windows box.  The first
> route takes files from a local folder and ftps them to a remote box.  The
> second route pulling from the ftp server and putting back in the same local
> folder:
>
> public void configure() throws Exception {
>        // Route 1
>        from("file://C:/cameltest?sortBy=file:modifed")
>
> .to("ftp://user@server/ftptest?password=password&reconnectDelay=10000&maximumReconnectAttempts=-1")
>        .errorHandler(
> deadLetterChannel("direct:retry").redeliverDelay(10000).maximumRedeliveries(-1)
>        );
>        // Route 2
>
> from("ftp://user@server/ftptest?password=password&reconnectDelay=10000&maximumReconnectAttempts=-1")
>        .to("file://C:/cameltest")
>        .errorHandler(
> deadLetterChannel("direct:retry").redeliverDelay(10000).maximumRedeliveries(-1)
>        );
> }
>
> I threw a few files in the local folder.  Everything worked fine until I
> unplugged my box from the network.  As expected it start throwing errors and
> retrying.  I then plugged the cable back in.  Route 1 was able to recover
> and pushed its files.  Route 2 wasn't as lucky it was stuck in a loop trying
> every second to list files on the remote directory and throwing the
> exception below.  Is there a way to get it to try to reconnect when this
> happens?
>
>
> Exception:
>
> 35339 [Camel thread 0: FtpComponent] WARN
> org.apache.camel.impl.DefaultPollingConsumerPollStrategy  - Consumer
> Consumer[ftp://user@server/ftptest?maximumReconnectAttempts=-1&password=password&reconnectDelay=10000]
> could not poll endpoint:
> ftp://user@server/ftptest?maximumReconnectAttempts=-1&password=password&reconnectDelay=10000
> caused by: File operation failed:  socket write error: Connection reset by
> peer.. Code: 150
> org.apache.camel.component.file.GenericFileOperationFailedException: File
> operation failed:  socket write error: Connection reset by peer.. Code: 150
>        at
> org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:385)
>        at
> org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:50)
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:68)
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:98)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.net.SocketException: socket write error: Connection reset by
> peer.
>        at jrockit.net.SocketNativeIO.writeBytesPinned(Native Method)
>        at jrockit.net.SocketNativeIO.socketWrite(SocketNativeIO.java:73)
>        at java.net.SocketOutputStream.socketWrite0(SocketOutputStream.java)
>        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
>        at java.net.SocketOutputStream.write(SocketOutputStream.java:137)
>        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
>        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
>        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
>        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:191)
>        at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
>        at java.io.BufferedWriter.flush(BufferedWriter.java:236)
>        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:472)
>        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:534)
>        at org.apache.commons.net.ftp.FTP.port(FTP.java:862)
>        at
> org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:463)
>        at
> org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2296)
>        at
> org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2269)
>        at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2048)
>        at
> org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:382)
>        at
> org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:51)
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:71)
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:98)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        ... 1 more
>
>
> --
> View this message in context: http://www.nabble.com/FTP-Component-Network-Failure-Recovery-Problem-tp24517828p24517828.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message