SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Publish and Subscribe to Events in SAP Integration Suite, advanced event mesh

Dive deeper into the message exchange, still by using the UI in AEM, and also explore a different section through which you can exchange messages.

Overview

🎓 intermediate 30 min. SAP Integration SuiteIntermediateSAP Business Technology Platform

You will learn

  • โœ”What are topics, subscriptions.
  • โœ”How to send and receive messages using Try Me! page in the event broker service.
Antonio Maradiaga A Antonio Maradiaga June 18, 2025
Created by May 19, 2025
Contributors

Prerequisites

Prerequisites

  • You have access to an SAP Integration Suite, advanced event mesh tenant.

Steps

Intro

You are now familiar with the basic UI elements in SAP Integration Suite, advanced event mesh (AEM).

In this tutorial, you will dive deeper into the message exchange, still by using the UI in AEM and you will also explore a different section through which you can exchange messages. Before you get to the exercise, you might need to expand a bit on some concepts.

Let’s get started.

Try Me! with Queue functionality
Try Me! with Queue functionality

Step 1 What is topic?
โ€”

In a previous tutorial, it was mentioned that a topic is a means by which a publisher classifies a message. A topic tells us what type of message you will receive if you subscribe to that topic.

In essence, it is a string that is composed of one or more levels. Each level is separated by a forward slash (/) and the levels can be anything. This is commonly known as topic-level granularity. The granularity allows for more targeted and efficient information exchange.

Instead of having a single topic for all updates on a business object in a complex system (/BusinessPartner), the system can have distinct topics for different types of updates on a business object (/BusinessPartner/Created, /BusinessPartner/Updated, /BusinessPartner/Deleted).

There is no specific schema/specification on how you need to structure your topic string but you do find that patterns are established within a system. Let’s get familiar with the structure of a topic by “dissecting” a real-world topic.

Below you can see a topic on which an SAP S/4HANA Cloud system will publish a Business Partner message.

Example: default/sap.s4/S4D/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1:

  • default/sap.s4/S4D: System information.
  • /ce: CloudEvent. You know that all events published by an SAP S/4HANA Cloud system follow the CloudEvent specification
  • /sap/s4: This is coming from an SAP S/4HANA system.
  • /beh/businesspartner/v1/BusinessPartner: Information of the business object that you will be receiving.
  • /Created: This is the action that took place in the source system. In this case, it is notifying us that a Business Partner was created. Many actions can take place in a system, for example, /Updated or /Deleted. In other cases, if you were dealing with a business object like a Purchase Order, there could be an event raised when it is /Cancelled or /Rejected.
  • /v1: Version of the message. If a new version of the message is made available โ€“ adding new fields to the payload โ€“ then this will change.

Now, by knowing the topic on which a message type will be published, you can create a consumer program/service that subscribes to the topic directly and processes the messages sent to it. Generally, you can subscribe to a topic by specifying the entire topic string when establishing the connection โ€“ for example, default/sap.s4/S4D/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1.

But what if you want to subscribe to all actions (Created, Updated, Deleted) that occur on a BusinessPartner object?

Luckily, in the case of SAP Integration Suite, advanced event mesh, you can subscribe to the topic by using wildcards (*). For example, by subscribing to the topic default/sap.s4/S4D/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/*/v1 you will be able to get all messages for different actions (Created, Updated, Deleted) whose version is v1.

In AEM, the > character can be used at the last level of a subscription to indicate a “one or more” wildcard match for any topics โ€“ for example, by subscribing to the topic default/sap.s4/S4D/ce/sap/s4/beh/> will bring all objects that are published under that prefix, independent of type, action, and version.

In the example above you can see how the topic level granularity can allow a consumer program/service to subscribe only to the information it needs.

Learn more about wildcard characters in topic subscriptions: https://help.pubsub.em.services.cloud.sap/Messaging/Wildcard-Charaters-Topic-Subs.htm

If our consumer program/service subscribes to a topic, you will receive all messages for that topic subscription. That said, a direct topic subscription lasts only as long as the consumer is connected. The problem here is that our consumer needs to be online to receive a message. If the consumer becomes unavailable then you will end up losing the message.

In some scenarios, this is unacceptable and you need to ensure that you receive and process all messages published. Fortunately, there is a mechanism to retain messages without the need for a consumer service to be online 100% of the time. Then, the consumer can process the messages asynchronously or whenever it is available.

Step 2 Basic message exchange
+
Step 3 Subscribe to SAP S/4HANA Cloud events in the Try Me! page
+
Step 4 Further study
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 4
1. What is topic? 2. Basic message exchange 3. Subscribe to SAP S/4HANA Cloud events in the Try Me! page 4. Further study

Learn more →