Google Pub/Sub is a reliable messaging tool that lets your systems talk to each other securely using 'topics.' It’s great for sharing data in real-time across different cloud platforms. With the Google Pub/Sub adapter in SAP CPI, you can easily send or receive messages, making it much simpler to connect your SAP processes with Google Cloud
The Google Pub/Sub Adapter is available in both sender and receiver modes to streamline message-based workflows and comes in two variants — REST and gRPC.
Key Features
- Publish single messages (Basic) or multiple messages (Advanced) at once.
- Use gRPC for real-time performance or REST for polling at defined intervals.
- Google Pub/Sub accepts only Base64-encoded data, and the adapter can handle encoding automatically.
- Provides multiple post-processing options: Acknowledge after Successful Processing, Acknowledge Immediately, and Do not Acknowledge.
- Supports Authentication via OAuth2 service account authentication and Workload Identity Federation.
Practical Use Case Walkthrough
In this section, we will demonstrate how to send SalesOrder data to a topic using the Google Pub/Sub Receiver adapter and then read the message again with the Google Pub/Sub Sender adapter, using the REST protocol for messaging.
Publish a Message using Google PubSub Receiver Adapter
Prepare Payload in Content Modifier
For the demonstration, we hardcode the SalesOrder data into the message body. In real time, you can dynamically store the payload from the source system.
Configure the Google Pub/Sub Receiver Adapter
Connection tab:
Parameter | Description |
Address | Specify the hostname to connect Google Pub/Sub. |
Authentication Type | Select the method for authentication to Google Pub/Sub.
|
OAuth2 Token URL | Specify the OAuth2 Token URL which identifies as the authorization server for producing a JWT token internally. |
Client Email | Specify Google Service Account Client Email. |
Private Key Alias | Specify the Google Service Account Private Key for authentication. |
Scope | Specify the scope of the connection to Google Pub/Sub service. |
Reuse Connection | Enable the reuse of connection objects from the internal connection pool which in turn improves the network turnaround time for multiple communications to the same end point. |
Connection Timeout (in ms) | Specify the maximum waiting time (in milliseconds) for the connection to be established with Google Pub/Sub service. |
Response Timeout (in ms) | Specify the maximum waiting time (in milliseconds) for a response message to be received with Google Pub/Sub service. |
Publish Message using Google Pub/Sub Adapter
Now let’s navigate to the Processing tab, select the Entity as Topic, and select the operation as Publish Message for the use case.
Also, provide the project ID and topic ID created on the Google Pub/Sub server.
Processing Tab:
Parameter | Description |
Entity | Select the entity for message processing:
|
Operation | Select the operation to be performed.
|
Project ID | Specify the Google Pub/Sub project ID. |
Topic ID | Specify the Topic ID created on Google Pub/Sub service |
Operation Type | Select the type of operation
|
Encode Data | Select the checkbox to encode data to Base64 |
Ordering key | Specify the ordering key for this message. |
Message Attributes | Specify multiple message attributes as key value pairs. |
Once you run the iflow, you can see the message processed successfully.
In addition, you can see that the Sales Order message was successfully published to the Google Pub/Sub service.
Read a Message using Google Pub/Sub Sender Adapter
The Google Pub/Sub Sender Adapter is available in gRPC and REST formats. For this demonstration, we're using the REST variant.
Processing Tab:
In the Google Pub/Sub Sender Adapter, provide the Subscription ID and Project ID from which the message will be read on the Google Pub/Sub Server.
You can also select the post-processing action once the message has been polled from the Google Pub/Sub Server.
Once the iflow is successfully deployed, we can check it in the monitoring page. In response, we can see the message body.
Conclusion:
The Google Pub/Sub adapter in SAP CPI brings integrations to life by allowing real-time, event-driven communication between SAP and Google Cloud. It enables CPI to easily publish and receive messages at scale, making integrations faster, more responsive, and loosely linked. The adapter's cloud-native design enables the creation of modern, durable integrations that can quickly change with business needs.
Quick Links:
- For information about Google Pub/Sub Sender adapter configuration, see SAP Help | Google Pub/Sub Sender Adapter.
- For information about Google Pub/Sub Receiver adapter configuration, see SAP Help | Google Pub/Sub Receiver Adapter.
- For detailed information about the Google Pub/Sub adapter, see Google Pub/Sub Adapter Guide
The next blog will take this further with an exciting new use case — so stay tuned for more insights and updates!