A C# Restful web service (on a Windows Server 2012 Standard) needs to send commands to equipments via my C# socket server program which is running on the same server. When the web services try to send a command to a selected equipment, the thread of the associated equipment can pick up the command and send it to this equipment. After it is picked, it should be deleted by this thread. At the same time, Thread n which is associated with Equipment n can also pick up a command of Equipment n, and Thread n can delete this command after this command is picked up and sent out. Please refer to the system architecture diagram below.
My question is what is the best way (the most effective, reliable solution) to allow the web services send the command data out and those socket threads can select their associated commands then delete those commands after they are sent out? These commands can be saved into the database and socket threads can check database periodically but this is not effective way especially when the amount of equipment and users is big. Do Named Pipes suit for this scenario and a thread can check these Pipe instances to find an associated command?