Bringing the Publish-Subscribe to a webpage near you ..

Google has opened up some new potential in their Gadgets API by allowing gadgets to communicate with one another. As you can imagine gadgets on a page can either be there or not, so communication has to be loosely coupled between the two. They achieve this using a Publish-Subscribe model (pub/sub). Designing gadget topology to use pub/sub implies that gadget don’t “expect” or “require” other gadget to be available on a page, but can function just as well if they are not. It also lends itself to scaling out quite elegantly, as there’s no overhead used for the components to synchronously talk to one another.

Incidentally, pub/sub is the model that Microsoft BizTalk is built around. It was fairly new to me when BizTalk 2004 first came out, but it’s the first model I look to now. BizTalk operates by using a central MessageBox to store all incoming messaging, then having different endpoints subscribe to types of messages. Again, this makes the architecture highly scalable and robust (albeit not focusing directly on latency). Latency won’t be too much of an issue for Google Gadgets talking to one another though, as things will appear to be happening on screen while the gadgets establish communication with one another.

Here’s a quick synopsis on how it works (thanks to Google Blogoscoped)

For instance, you can create two gadgets, A and B, which you will “bind” to each other using the same name “test001”. Then, in the user preferences portion of the XML-based gadget, A contains the parameter publish="true”, making it a publisher gadget. And B will contain the parameter listen="true” and the event on_change="updateMessage”, making it a subscriber gadget.

If you design Google Gadgets, check out the documentation here

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.