2024 Oct 21 9:42 PM
In Part 1 of our series, we introduced you to the core concepts behind SAP Event Mesh and how event-driven architecture enables modern, decoupled systems. In this part, we will explore two important event types: Notification Events and Data Events, and how they function within SAP systems.
Before we dive into the specifics, let’s briefly define the key players in an event-driven architecture: event producer, event broker, and event consumer.
Event Producer: An event producer is a system or component that detects or triggers significant changes, such as the creation of a new sales order, an employee hiring, or an update to an inventory. This system sends out an event to notify other systems that the change has occurred. For example, an SAP S/4HANA system might be the event producer when a new sales order is created.
Event Consumer: The event consumer is the system or application that subscribes to and processes events. This could be an SAP or third-party system that reacts to events such as a SalesOrder.Created or a new employee hire. The consumer can either take immediate action based on the event data or request more information if needed.
Event Broker: The event broker is the intermediary responsible for managing events. It ensures that events sent by producers are routed to the appropriate consumers. Event brokers handle the distribution, delivery, and monitoring of events, ensuring that consumers receive the right notifications or data at the right time. SAP Event Mesh itself acts as an event broker in SAP systems, decoupling producers from consumers for scalable and flexible communication.
Now that we understand the roles of event producers, brokers, and consumers, let’s look at the two primary event types used in event-driven architectures: Notification Events and Data Events.
Notification events inform consumers about significant changes in the system, but only include minimal data. The goal is to notify the consumer about an event, and if the event is relevant, the consumer can request more information or trigger additional actions. Notification events are especially useful when the consumer doesn’t always need the full details of an event immediately.
How Notification Events Work
In an SAP system, let’s say a new Sales Order is created. The event producer (the SAP S/4HANA system) sends a SalesOrder.Created notification event. This event is small and only contains the Sales Order ID and a link for further details. The consumer, upon receiving the notification, can decide whether to fetch more details or ignore it if it's not relevant.
The event is sent through the event broker (SAP Event Mesh), which manages subscriptions and makes sure the notification reaches all relevant consumers.
Figure 2.1 shows an example notification event for the creation of a sales order in an SAP S/4HANA backend system. The notification event is of type SalesOrder.Created and contains only minimal data, namely the ID of the sales order that was created.
Figure 2.1: SalesOrder.Created Notification Event
Data events, in contrast to notification events, include all relevant information about the change directly within the event. This means the consumer can process the event immediately without needing to make any further requests. While this makes data events more powerful, it also means they are larger and can incur higher costs in terms of resources and data security.
How Data Events Work
Let’s consider an SAP SuccessFactors scenario, where a new employee is hired. The Employment.AssignmentInformation.Hire event contains all relevant details—like the employee’s start date, sequence number, and user ID. This allows the consumer to begin processing immediately, without querying for more data.
Data events are sent through the event broker, which distributes them to all relevant consumers subscribed to this type of event.
Figure 2.2 shows an example data event for an employee hire in an SAP SuccessFactors backend system. The event is an SAP SuccessFactors Intelligent Services event and is of type Employment.AssignmentInformation.Hire. You can see that the event holds more information, for example, the effective start date of the hired employee and a sequence number on top of the user ID. This event is actually a very small data event. Data events can be a lot bigger if needed. SAP SuccessFactors Intelligent Services events currently don't follow the CloudEvents standard.
Figure 2.2: Employment.AssignmentInformation.Hire Data Event
The decision to use notification events or data events depends on the specific needs of your system. Here are some guidelines:
In Part 3, we will explore CloudEvents and event standardization, helping you navigate how to further optimize your SAP systems for event-driven architecture. We’ll discuss how to ensure that your events conform to best practices and are easily consumed by diverse systems.
Stay tuned for more insights into SAP Event Mesh and Event-Driven Architecture!
This blog draws heavily on resources from SAP Press, with special thanks for their in-depth insights and comprehensive coverage of SAP Event Mesh in event-driven architecture.