c# – How would I write this ftp client soap consumer in Ruby? – Education Career Blog

I have a project that I’m starting soon and thought it might be fun to write it in Ruby. Here are the basic requirements:

  1. Must be run as a background process
  2. Will be running all day
  3. Process should sleep for 10 seconds then check 6 different ftp servers for new files
  4. From 4 of the servers, just pickup the files then ftp to a different server on our network
  5. From 2 of the servers, parse the data and post to a .net soap based web service
  6. Log what was received and sent into a daily log file or database

I can use either a linux or windows server. What do you think? Is this doable in Ruby or should I just stick with .net? Can I have multiple threads for each server that I need to check? How would I run this as a service?

,

I’d do this with Windows Workflow Foundation. You can easily create a workflow that checks the various FTP servers in parallel. The entire activity of checking the FTP servers can execute repeatedly (forever), sleeping the 10 seconds. You can even use the Tracking feature to do logging globally so that the individual activities don’t have to.

A workflow can easily be run in a service. Just create a service in Visual Studio, override the OnStart event, and use it to coinfigure the workflow host (to do the logging), and then just start the workflow.

,

You should look into the Daemons gem, it will run your script in the background and provide the start, stop, and restart service hooks. You can use the Thread class to setup your threads. Once you have created your scripts, start them using daemontools. It will monitor, and restart your service if it goes down.

Leave a Comment