Table of Contents |
---|
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. The message paradigm that is used underneath is the publisher/subscriber modelApache 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 microsite or a dashboard. The following image explains the publisher-subscriber communication paradigm:
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:
...
Gadgets usually communicate with the gadget-container via features and those features are declared in the the ModulPrefs
ModulePrefs
section in the gadget.xml
file.
...
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 will come comes in use.
If there is a gadget that are two gadgets where one has a time slider and another gadget that displays 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 will need needs to be a publisher gadget and the other gadget will need gadget needs to be a subscriber gadget as it needs to listen to the time slider gadget's channel.
For more information on inter-gadget communication, see the samples.
What's Next?
Info | ||
---|---|---|
| ||
See how pub-sub is configured for inter-gadget communication in Configuring Inter-gadget Communication. |