com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Inter-gadget Communication

Introduction

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 model, which is commonly known as the Pub/Sub model. WSO2 User Engagement Server (UES) 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.

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 UES 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 User Engagement Server

Gadgets usually communicate with the gadget-container via features and those features are declared in the the ModulPrefs 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.

Real world scenarios

The UES 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 UES will come in use.

If there is a gadget that has a time slider and another gadget that 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 to be a publisher gadget and the other gadget will need 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.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.