Tightly-Coupled and Loosely-Coupled Interactions
Tightly-Coupled Interactions
With tightly-coupled interactions, both the publishing apps and the subscribing apps are designed to work together. All of the apps know the names of the topics that are published and the topic payloads (the event data). Each app implements an interaction using just the publish or subscribe API methods. The wiring between publisher and subscriber for each payload is implicit based on matching topic and property names.
Note: | This represents the most basic form of app interaction. Tightly-coupled interactions were also supported inMashZone NextGen2.7 or earlier releases for mashlets. |
With tight-coupling, all the apps in an interaction are typically designed and created at the same time. In many cases, the apps are not designed to work effectively without the other apps in the interaction.
A simple example of tight-coupling is a publisher app with a summary view of data combined with a subscribing app that has a detailed view of data, a master/detail relationship.
Loosely-Coupled Interactions
With loosely-coupled interactions, apps are designed to support interactions, but users choose which apps and interactions to actually wire to work together. Apps that support loose-coupling can be used alone and can also be wired with many different apps for different purposes. Because the apps that may be wired in an interaction are not necessarily created together with a specific interaction in mind, loose coupling is much more flexible.
For loose-coupling to work, apps must explicitly declare what topics they publish or subscribe to in their App Specification. Apps also must use the publish or receive API methods to support interactions.
Note: | Basic apps that users create in the App Maker wizard support loosely-coupled interactions. They all subscribe to one topic that can be used in wiring interactions. If the views included in the basic app have events, the apps also publish topics. |
Users can add apps that support loose coupling to a workspace in Mashboard and then explicitly wire the apps to complete the interaction configuration. Wiring allows the workspace to map mismatched topic names, and in many cases to map published topic payloads to the subscriber’s topic payload.
Implementation Requirements
The types of apps and implementation requirements for tightly- or loosely-coupled interactions include:
| Tightly Coupled Interactions | Loosely Coupled Interactions |
Basic apps | --- | Use the publish and receive methods. Must be wired in a workspace app by users in Mashboard. |
Custom apps | Use the publish and subscribe methods. Require specific parameters in the <script> tag that embed both publisher and subscriber apps. |