I have a Windows service written in C# that handles processing of digital documents, and a web application written in PHP. I need to be able to notify the C# service that new documents are ready for processing.
Currently, the C# service is reading the MySQL database every 10 seconds to see if there are new tasks to be performed. This creates a 10 second lag in the responsiveness of the web application. I'd like to be able to trigger the C# service immediately when the document is ready.
I'm looking for an answer that will allow PHP to notify the C# service without any delay.
Here are some possible ideas that I've had;
- Use a shared memory object between PHP and C#, and have a thread in C# wait for that object to be signaled. Is this possible with PHP?
- PHP connects to C# using a socket on localhost, sends a nak and disconnects. This seems inefficient to me.
- Configure MySQL to use an in-memory table, and have the C# service query the table every second.
- Is it difficult to create some kind of web service in C# that uses XML or SOAP, and would there be any lag (+1 second) in calling that service via PHP?
That's all I can think of. Maybe there is some kind of standard way this should be done, and I'm just not aware of it.