I’m developing a master-slave command model by which some application “Master” sends commands to homogenous processes called “Slave” to do some task and then respond back with status complete or process failure. they should also expose some data to the master available on request.
What would this model look like in WCF?
would Master and each instance of Slave host thier own services? would only Master host? only Slave? Should I be using Callback Contracts? Data Contracts? or just Service Contracts.
As a side note, this is a low bandwidth, low intensity, internal only distribution project used for product testing and should not be considered as a “large high demand” project.
You will definitely have service contracts – a must – in some shape or form. This just defines your service and the operations (methods) on it (OperationContract).
If it’s an internal “behind-the-firewall” system, you could look at a duplex binding, e.g. have the Master call the Slave, and the Slave report back on a duplex channel when it’s done. Out of the box, there’s only the WsDualHttpBinding to support duplex, but since you’re internal, behind-the-firewall, you might want to look at creating your own TCP-based duplex binding (it’s not as hard as it might sound at first!).
In this scenario, both involved apps really are server and client at the same time.
You will have DataContracts in some way, shape or form to define the DATA that is being moved around between Master and Slave – so again, yes, you will have to have Data Contracts.
EDIT:
Of course, another approach might be to use two MSMQ message queues; the Master drops his “job” request into a queue, which the Slave listens on and picks up the job request. When the Slave is done, it in turn drops a response into the response queue to which the Master is a listener, and gets notified of the job being done that way.
Marc