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;
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.
It'd be pretty trivial to make a REST facade in WCF that triggers your c# service on a POST against /. Security can be layered on depending on the nature of your deployment.
I'm going to go ahead and try to answer this.
In your service, add an OnCustomCommand handler as described in this question to trigger the service work: How to send a custom command to a .NET windows Service from .NET code?
Create a separate C# application that simply sends the command to your service and call that from PHP via the exec() function.
You could self-host an ASP.NET WebAPI in your service