Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 

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 

Tejas_Amale_1-1768571896351.png

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. 

Tejas_Amale_1-1768569446926.png

Configure the Google Pub/Sub Receiver Adapter 

Tejas_Amale_3-1768569622628.png

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 Service Account 
  • Workload Identity Federation  

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. 

Tejas_Amale_4-1768569826371.png

Processing Tab: 

Parameter 

Description 

Entity  

Select the entity for message processing:  

  • Topics 
  • Subscriptions  

Operation  

Select the operation to be performed.  

  • Publish Message
  • List  

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  

  • Basic 
  • Advanced  

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. 

Tejas_Amale_5-1768569920246.png

In addition, you can see that the Sales Order message was successfully published to the Google Pub/Sub service. 

Tejas_Amale_6-1768569963005.png

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. 

Tejas_Amale_7-1768570045531.png

Processing Tab: 

Tejas_Amale_8-1768570074421.png

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. 

Tejas_Amale_9-1768570108726.png

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: 

The next blog will take this further with an exciting new use case — so stay tuned for more insights and updates!

3 Comments
Labels in this area