Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Occasionally a large file is dropped into a Windows folder on our corporate Internet, and whenever it is, it should be inserted into a staging table in the database.

The database will consume the staging table on a schedule. The Oracle database is on the UNIX side, and the files are on the Windows side.

What I have tried:

(1) I have mostly finished implementing a Windows service in C# which continuously watches the folder for changes given an XML config file, and

(2) I have finished implementing an efficient importer which uses the Managed Oracle Client if it is given the file name and the same XML config file.

Question:

How do I connect the two components using best practices? I want to have (1) call (2) spawning a separate thread for each file. So do I use Threading, Background Workers, or Tasks?

I like the idea of an event which fires when a new large file has finished changing.

I like the idea of subscribing to this event and doing whatever you like with that knowledge.

Yet I want to keep it simple.
Posted
Updated 12-May-16 7:25am

1 solution

There are several ways, but best practice to me seems WCF (Windows Communication Foundation).
If your components are on the same machine, named pipes would be the most efficient I think.
Here is a named pipe example: WCF Tutorial - Basic Interprocess Communication - Tech.pro[^]
You can find more samples here: Windows Communication Foundation (WCF) Samples[^]
And an example on CodeProject here: A Simple Sample: WCF Service[^]
 
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