HowTo – Publisher/Subscriber Model Design

24 07 2007

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,

publish-subscriber-logic.png

(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 🙂

Creative Commons License Creative Commons License

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: