views:

37

answers:

4

I'm writing a service in C# on Windows which should be triggert by an PHP driven web frontend, which runs on Linux.

Both processes share the same SQL Server 2005 database.

There is no messaging middleware available atm.

The PHP process inserts an row in a SQL Server table. The Windows process should read this entry and process it.

I have no experience in PHP, so what would you suggest to notify the Windows process?

+1  A: 

I see at least 2 ways to accomplish that task:

  1. Host in process WCF service in windows service and call it from PHP.
  2. Write events in the database from PHP and subscribe on them using SqlDependency.
Yauheni Sivukha
A: 

Check out SqlDependency in .Net. It allows you to set a trigger on the SQL server. There's a sample app at MSDN.

Mikael Svenson
A: 

Have the service periodically poll the database table that the PHP process writes to. I do something similar and have a column in the table that is null to begin with, and then is set by the Windows service once the row is processed. The service merely asks for the first row that contains a null in this field, does it's thing, then updates the field, and then repeats. This way if the system or app crashes then when restarted it continues with that unprocessed row. Remember to bracket your reads and writes in transactions.

ebpower
A: 

I'm answering my question here, because in the end we notified the app via plain old sockets.

So a valid answer to my question is use sockets.

Louis Haußknecht