Skip to content

Improving MessageBroker: Centralizing ID and Subscription Logic

Problem Description

The current implementation of the MessageBroker (the issuer) requires each Pane's MessageView (the consumer) to implement its own logic for storing its ID and subscription details (i.e., the Mavlink IDs of interest). This approach places the burden of ensuring consistency (e.g., maintaining a stable ID) on the implementor.

Rationale Behind the Current Implementation

The chosen solution aimed to address the identification problem: how can the MessageBroker determine who is requesting updates, and how can it manage the dispatch of messages to the appropriate recipients? To achieve this, an identification mechanism was deemed necessary. Two main approaches were considered:

  1. Consumer-Managed ID (Current Approach):

    • The consumer is responsible for managing its ID and subscription details.
    • When refreshing a view, the issuer interacts directly with the consumer, leveraging the ID stored within it.
  2. Issuer-Managed ID:

    • The MessageBroker manages IDs centrally.
    • Consumers rely on the ID initially assigned by the MessageBroker for updates.
    • While this approach simplifies the consumer's responsibilities, it requires the Pane to handle its own ID in a consistent manner.

Is a Fully Transparent Solution Possible?

A key question remains: can the MessageBroker transparently manage all subscription and identification details, eliminating the need for consumers to handle IDs entirely? Further exploration is needed to determine the feasibility of this approach.

Proposed Alternative

The MessageBroker should take full responsibility for managing subscription details, including ID handling. By centralizing this logic, the system would:

  • Reduce the complexity for consumers.
  • Lower the cognitive overhead required to understand and adopt the subscription process.
  • Promote a more consistent and maintainable implementation.

This approach shifts the burden from consumers to the MessageBroker, making the subscription process more intuitive and easier to use.