Archive for September 11, 2006

Publish Subscribe model

Think of all the facilities that you have in your lifestyle for which you have subscribed.  Examples could be newspapers and magazines, cable TV, internet connection and the list can go on.  Think about this model. A publisher here is an entity that is capable of producing and/or delivering information/content of specific type.  A subscriber is the one who wants that information/content to be consumed.  There could be many publishers each of them having many subscribers.  Putting it differently there could be many subscribers subscribed to many publishers.  In every model there is a contract or an agreement that binds two entities.  In case of a publish subscriber model the contract is that a subscriber subscribes to a publisher and once the subscription is enabled the publisher delivers the information/content to all its subscribers at appropriate time without the subscriber requesting it.  Think of subscribing to a local newspaper agent who will put newspaper at your doorstep every morning.

Publish Subscribe model is popular in the software industry.  The differentiator with traditional client/server approach is the way the information/content is received by the client.  In the traditional approach, the client requests for specific information from the server and the server sends back the information.  In publish subscribe model once the client subscribes to the publisher, the publisher pushes the appropriate information/content to the client without the client requesting it.  The former uses the pull technology and the latter the push technology.  Typical examples of such a model is subscribing to newsletters, online magazines, why even the RSS feeds you receive from TechMasala as well.

There are also cases when the client will not know who or where the publisher is for the information/content it is looking for.  In such a case there are brokers whose primary role is to help subscribers subscribe to the publisher who can deliver the content it is looking for.  This broker has the list of publishers and what they can deliver.  A subscriber could talk to the broker, tell its requirement and the broker gets the subscriber connected to the appropriate publisher.