Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is a good C# pattern to use for a program that will watch an FTP site for files received? Specifically, a pattern that with high-availability / enterprise-level failover in mind.
Posted
Comments
PIEBALDconsult 3-Sep-15 10:46am    
That may depend on the polling frequency and how long the download takes. For infrequent (longer than, say, ten minutes) I'd use a Windows Scheduled Task or an SQL Agent Job. For more frequent polling, I'd use a Windows Service. With certain protections in place, either of these could probably be active on multiple systems at once to provide some fault tolerance. It also depends on what you're doing with the files.
Kevin Marois 3-Sep-15 11:41am    
FilesystemWatcher?

1 solution

The whole formulation of the problem is the apparent anti-pattern. Please see:
https://en.wikipedia.org/wiki/Anti-pattern#Software_engineering[^].
One anti-pattern is well-known and can be found in the list of anti-pattern published in this article: see "The use of patterns has itself been called an anti-pattern, a sign that a system is not employing enough abstraction".

I formulate the similar methodological problem like this: "thinking that the use of some pattern is the goal of development".

Another anti-pattern is not in the list. I call it: using the architecture which requires polling. To understand the problem, please see my past answer: Application 'dashboard' for website accounts[^].

Note that the problems I tried to outline in this answer cannot be solved with FTP, which is inherently oriented to pure client-server model (https://en.wikipedia.org/wiki/Client%E2%80%93server_model[^]). With HTTP, it is just difficult, but there are work-around solutions, but not with FTP.

So, the bottom-line is: you don't need to look for a pattern for this approach. You can work in two directions 1) change the architecture to the one excluding polling; 2) still explore the polling from FTP, if this is unavoidable, but simply use critical thinking and your brain to design the solution in a rational ways. Which ways? it depends on your other requirements and ultimate goals, which you did not share with us.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900