- WCF and Publish Subscribe– A Full Example: Introduction
- WCF Publish Subscribe–A Full Example – The Service Side Part 1 (Interface)
- WCF Publish Subscribe– A Full Example: The Service Side Part 2 (Implementation)
- WCF and Publish Subscribe–A Full Example: The Event Generator
- WCF and Publish Subscribe–A Full Example: Client Code
- WCF and Publish Subscribe–A Full Example: Running the Client (Subscriber)
The Service code consists of an Interface (IMagazineService) and its implementation (MagazineService).
The Interface defines all the capabilities of the service. What do we really want from a Publisher service?
- A Publish method (called PublishMagazine)
- A Subscribe method (to allow clients to subscribe to the service)
- An Unsubscribe method (to allow clients to unsubscribe from the service)
Those are the three main things we need from our Publisher service. As long as all we need is the Publisher to get in touch with multiple subscribers, we are all set.
However, we also need a way to notify individual clients (subscribers) who have subscribed to our service.
This can be handled via a Callback method (called MessageReceived in our example). The Callback method is best made available as part of a separate interface (known as IClientContract).