Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Introduction

In the WSO2 Dashboard Server (DS), the gadget technology is based on the  OpenSocial public specification. DS renders the gadgets and add other features (e.g., communication, security, UI layouts) using  Apache Shindig, which is an OpenSocial container and solution that is used to start hosting OpenSocial apps quickly, by providing the code to render gadgets, proxy requests, and handle REST and RPC requests. Inter-gadget communication is the capability of one gadget being able to communicate with another gadget (such as, the capability of Gadget X to send some data to Gadget Y and Gadget Y's capability of getting updated with the data that it received. Apache Shindig uses the publisher-subscriber  communication paradigm for communication purposes, which is commonly known as the Pub/Sub model. This paradigm is asynchronous, loosely coupled, autonomous and also a data-centric approach for communication. The following are the three main components that make-up this paradigm: Publisher, Subscriber and Notification System. WSO2 Dashboard Server (DS) supports inter-gadget communication with the help of publisher and subscriber gadgets, allowing gadgets to communicate with each other while running within a dashboard. 

What is Pub/Sub?

Publisher/Subscriber (or pub/sub) is a messaging paradigm where a sender (or a Publisher) sends messages without specifically targeting one receiver. A receiver (or a Subscriber) declares interest in one or more messages published by a publisher or a set of publishers. The Message Broker keeps track of the publishers, subscribers and their subscriptions. In addition, the Message Broker will also take the responsibility of routing the messages, by utilizing a store-and-forward mechanism. In the context of the WSO2 DS these roles are as follows:

  • Publisher - Any gadget importing the pubsub-2 feature and publishing to one or more named channels.
  • Subscriber - Any gadget importing the pubsub-2 feature and subscribing to one or more named channels
  • Message Broker - WSO2 Dashboard Server

Gadgets usually communicate with the gadget-container via features and those features are declared in the the ModulePrefs section in the gadget.xml file.

Gadgets convey their interest to either publish or subscribe to a channel via the gadgets.Hub.* API. Therefore, the pubsub-2 feature needs to be imported to load the necessary API fragments and this feature can be declared in the ModulePrefs section of the gadget. The following image explains the publisher-subscriber  communication paradigm:
 

Real world scenarios

The DS pub/sub model can be used for various requirements in the real world. The following is an example of a real world scenario where inter-gadget communication in DS comes in use.

If there are two gadgets where one has a time slider and another gadget displays the number of builds for each app based on a time period, and if the latter mentioned gadget is required to display the number of builds for each app based on the time period that was selected in the time slider gadget, then the gadget with the time slider needs to be a publisher gadget and the other gadget needs to be a subscriber gadget as it needs to listen to the time slider gadget's channel.

What's Next?

See how pub-sub is configured for inter-gadget communication in /wiki/spaces/SM100/pages/14221862.

  • No labels