After a thorough reading done here, I think I have understood how the Publisher/Subscriber model is implemented.
To know more about this Publisher/Subscriber model, have a look here. The reading should let you understand this model.
Then I went on exploring the Windows Vista SDK where I had WCF documentation and found the List Publisher/Subscribe sample. I havent run the application or implemented it, but got the logic what they do.
Here is the representation of that,
(Click on the image to enlarge)
To explain briefly,
- We have a WCF Service (Above diagram tells that the WCF Service is hosted in IIS)
- Design the callback contract between the Service and Client
- Setup a Delegate and Event and the delegate method handler is going to raise that particular event
- So, when clients subscribe, we increment the event handler which would point to the client’s callback function
- Now we build a separate datasource which implements the service callback contract
- This datasource is responsible to call the Publish function
- The Publish functions is just going raise the event and thus every callback in the Event will be called up now
In this way, one can easily implement Publish/Subscribe method.
More on coding next 🙂