Understanding Direct and Guaranteed Messaging

Objectives

After completing this lesson, you will be able to:
  • Explain the key components and patterns of Event-Driven Architecture
  • Differentiate between direct messaging and guaranteed message delivery

Overview of the Event-Driven Architecture Patterns

The event-driven architecture (EDA) paradigm is becoming increasingly important in modern software architecture. It enables a loose coupling between services by generating, forwarding, and consuming events without direct dependencies between senders and receivers. It improves the scalability, flexibility, and fault tolerance of systems.

The following graphic shows the central structure of an event-driven architecture with the key components and concepts.

Flowchart depicting event-driven architecture. Event Generation, Communication, Error Handling, Deployment, Governance, Migration, Consumption, and Consumer Scalability. Senders/Publishers and Receivers/Subscribers interact via Brokers.

Details of the architecture

The graphic shows the event-driven architecture with various architecture patterns depending on the components. We are only interested in the patterns implemented by the broker. The most important ones are:

  1. Communication
    • Publish-Subscribe: Multiple recipients can subscribe to an event
    • Point-to-Point: Direct communication between two parties
    • Request-Reply: Event-based requests with response mechanism
    • Event Streaming: Continuous processing of real-time events
  2. Deployment Architecture
    • Event Bridge: Mediation of events between different systems
    • Event Mesh: Fully distributed event network
    • Event Gateway: Control of the event flow
  3. Governance
    • Event Catalog: Cataloging and management of events
    • Event APIs: Standardized interfaces for event access
    • Intermediated versus Disintermediated: Control of the interaction between services
    • Event APIs: Standardized interfaces for event access
    • Access Control and Authorization: Security mechanisms for controlling access

Direct and Guaranteed Messaging

Modern event brokers support direct and guaranteed messaging.

Chart comparing direct messaging and guaranteed messaging: direct messaging is for high message rates with low latency, no storage, messages can be discarded, no delivery confirmation; guaranteed messaging ensures permanent storage, no message loss, retention until consumption, delivery confirmation.

There are two primary messaging approaches: Direct Messaging and Guaranteed Message Delivery.

Direct Messaging is designed for applications that handle a high rate of messages and require low latency, while being able to tolerate occasional message loss. In this model, clients subscribe directly to topics. If a connection is lost, messages are not stored, meaning they can be discarded. Additionally, there is no delivery confirmation mechanism.

Guaranteed Message Delivery, on the other hand, is intended for applications that require permanent message storage and reliable delivery. In this approach, topic subscriptions are bound to specific endpoints. Once a message is confirmed, it cannot be lost. Messages are retained until they are consumed, and delivery is explicitly confirmed.

Persistence and Durability

Two sections: Persistence (messages stored in non-volatile memory, acknowledged, requires persistent delivery mode). Durability (endpoints function independently, queue retained despite broker failure, temporary queues delete messages).

Persistence refers to messages and durability refers to endpoints.

  • Persistence:
    • Messages are persistent if they are stored in non-volatile memory.
    • Storage takes place with "Persistent Delivery Mode = Persistent" or by subscribing to a persistent endpoint.
    • Persistent messages are acknowledged.
  • Durability:
    • Persistent endpoints function independently of consumers.
    • Queue messages are retained even in the event of broker failure.
    • Temporary queues are not persistent and messages are deleted after the consumer logs out.

Read More

  • Event Driven Architecture Pattern: Overview of different event-driven architecture (EDA) patterns, their use cases, and best practices for implementing event-driven systems.
  • Direct Messages: Explanation of direct messaging in SAP Advanced Event Mesh, including how messages are sent, routed, and received without persistence.
  • Guaranteed Messages: Detailed documentation on guaranteed messaging, ensuring message persistence, reliability, and delivery confirmation in SAP Advanced Event Mesh.