Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Punith_Oswal
SAP Champion
SAP Champion
1,117

Introduction:

With the growing demand for real-time integration, SAP Cloud Integration (SAP CI) offers a specialized Salesforce Pub/Sub Adapter to efficiently subscribe to Salesforce events and process them within your integration flows. This adapter leverages Salesforce’s Pub/Sub API, which is built on the gRPC-based protocol, and supports delivery of Change Data Capture (CDC), Platform Events, and Custom Events.

What is the Salesforce Pub/Sub Adapter (Sender)?

The Salesforce Pub/Sub Sender Adapter in SAP CI allows you to listen to Salesforce event streams in real-time. Instead of polling for changes or using API calls, this adapter maintains a persistent connection to Salesforce’s event bus, capturing events as they occur.

Key highlights:

  • Event Driven/Real-time event processing with low latency.

  • Supports Standard and Custom Events, including CDC.

  • Works via secure authentication (OAuth 2.0 JWT Bearer Flow).

  • Push-based, not pull – ideal for scenarios where immediate action is needed upon data changes in Salesforce.

This blog will focus on demonstrating how the Salesforce Pub/Sub Sender Adapter in SAP Cloud Integration captures Change Data Capture (CDC) events from Salesforce. It will also walk through the steps to activate CDC events on Salesforce objects within the Salesforce system.

Punith_Oswal_14-1745922281918.png

Use Case : Let’s focus on the "Account" entity, which the Salesforce Pub/Sub Sender Adapter will monitor to receive Change Data Capture (CDC) events in real time

Configurations within Salesforce System:

Log on to your Salesforce Account. Go to Home > Setup Menu > Setup 

Punith_Oswal_0-1745916272766.png

Setup page will be opened in a new tab, Search for "Integrations" in Quick Find then select "Change Data Capture"

Punith_Oswal_1-1745916446604.png

In the Change Data Capture section, you’ll find two tables: the left table displays all available entities, while the right table lists the entities selected for data change tracking.

To activate Change Data Capture for the 'Account' entity, simply search for 'Account' in the left table and move it to the right table using the arrows present in between the tables.

Punith_Oswal_2-1745916837850.png

Punith_Oswal_3-1745916873132.png

We are all set on the Salesforce, let go to SAP CI and configure the Sender Adapter now.

SAP CI Iflow:

Punith_Oswal_5-1745917072845.png

Start Message: Since this is an event-based push mechanism, we use a Start Message in the integration flow to ensure it gets triggered immediately when an event is generated in the Salesforce system.

Sender : Pick a sender from the pallet and select the Salesforce Pub Sub Adapter from the adapter list

Punith_Oswal_6-1745917348204.png

Configuration of Salesforce Pub Sub Sender Adapter:

Punith_Oswal_4-1745917048213.png

 

Parameter Description

Host

Specify the host to which the proxy requests are sent for the gRPC API (towards the gRPC host). The proxy requests to the gRPC host will go through the proxy.

Example: api.pubsub.salesforce.com

PortSpecify the port to which the proxy requests are sent for the gRPC API (towards the gRPC port). The proxy requests to the gRPC port will go through the proxy.

Example: 7443

Tenant IDSpecify the Salesforce Organization ID, this can be found in Company Information within the "Setup" page on Salesforce
Authentication
Select the authentication type to be used for the connection to Salesforce:
  • OAuth 2.0 Username-Password
  • OAuth 2.0 JWT Bearer

 

Token URLSpecify the login endpoint to your Salesforce instance url.

Example: https://login.salesforce.com for Salesforce production environment, https://test.salesforce.com for Salesforce Sandbox environment and https://{MyDomain}.my.salesforce.com in case MyDomain is enabled on the org.

Credential NameSpecify the User Credentials storing the username-password details.
Security Token AliasSpecify the Security Token Alias that points to the Secure Parameter. It can be omitted if your IP has been whitelisted on Salesforce.
OAuth Credential Name

Specify the OAuth Credential Name that refers to the user credentials (Consumer key-Client secret pair).

AudienceSpecify the login endpoint to your Salesforce instance URL.

Example:https://login.salesforce.com for Salesforce production environment, https://test.salesforce.com for Salesforce Sandbox environment and https://site.force.com/customers if implementing for an Experience Cloud site

Subject AliasSpecify the Secure Parameter that stores the username of the Salesforce user.
Issuer AliasSpecify the Secure Parameter which indicates the OAuth client_id of the connected app in Salesforce for which the certificate was registered.
Keystore AliasSpecify the alias name of the added JKS file in Keystore as a Key Pair. It consists of key and certificate to sign the JWT.
Expiration (in ms)Specifies the validity of the assertion in milliseconds.
Connection Check Interval (in ms)Specify the interval in milliseconds to verify the connection validity of the gRPC.

Processing Tab:

Punith_Oswal_7-1745918238405.png

Channel Name : For CDC Events, the channel name is generic and it starts with /data/{{EntityName}}ChangeEvent, in our case it is /data/AccountChangeEvent

Replay ID Approach : Replay ID is the unique ID that is generate for every event, The adapter offers 3 approaches here.

  • Events from a Specific Position (Custom):
    Use this option to listen to events starting from a specific Replay ID. Ideal when you want to resume from a known checkpoint. Once selected, a parameter called Replay ID is enabled where ID can be specified.

  • Events from the Earliest Position (Earliest):
    This option starts listening from the oldest available event in the event bus at the time of adapter deployment. It captures all events retained in the event bus

  • Events from the Latest Position (Latest):
    This option starts listening from the latest event at the moment the adapter is deployed. It ignores older events and captures only new incoming ones from that point onward.

Request Batch Size : Specify the number of events to be requested in the Salesforce fetchRequest. The Maximum events that Salesforce can return in a single call is 100

Replay Preset for Invalid Replay ID : 

Select the replay option in case sfdc.platform.eventbus.grpc.subscription.fetch.replayid.corrupted error occurs:

    • Events from latest position (Latest)
    • Events from earliest position (Earliest)

Duplicate Check Expiration (in ms):

SAP CI operates with two active worker nodes that can simultaneously consume events from Salesforce, which introduces a possibility of duplicate processing. The adapter handles this internally by performing a duplicate check. This parameter defines the expiration time (in milliseconds) for which an event is considered during the duplicate check, helping to prevent redundant processing.

Process Errors as an Event:
This option is useful for debugging errors occurring on the Salesforce backend. When enabled, errors are streamed as events and can be received in SAP CI, allowing you to monitor and track issues directly within your integration flow. If disabled, connection or processing errors related to event streams will be logged only in Salesforce, without being sent to SAP CI.

Deployment of the IFlow:

Now lets deploy the IFlow and see how this works, For demostration, I will manually change one of the fields in the Account records and wait for the event to get triggered in SAP CI.

For the Account below, I will update the Phone number from 123-456-7890 to 999-999-9999

Existing Account :

Punith_Oswal_8-1745920670642.png

After Change in Phone Number:

Punith_Oswal_9-1745920754862.png

As soon the record is saved in the Salesforce, the event/message is generated which is received by SAP CI

Punith_Oswal_10-1745920844197.pngPunith_Oswal_11-1745920866775.png

Response Payload :

Punith_Oswal_12-1745921047382.png

Punith_Oswal_13-1745921070479.png

Conclusion

The Salesforce Pub/Sub Sender Adapter in SAP Cloud Integration offers a powerful, real-time, and event-driven approach to integrate Salesforce with your enterprise systems. By eliminating the need for polling and leveraging Change Data Capture and Platform Events, it ensures faster response times, reduced API consumption, and greater integration reliability.

With a straightforward setup, built-in duplicate handling, and flexible event replay options, this adapter is a game-changer for businesses looking to streamline their Salesforce-driven processes.

If you're looking to enhance your Salesforce integration strategy and unlock the full potential of real-time data, now is the perfect time to start using the Salesforce Pub/Sub Adapter in SAP CI.

I hope this helps!!

References : 

https://help.sap.com/docs/integration-suite/sap-integration-suite/configure-salesforce-pub-sub-sende...

https://api.sap.com/package/SalesforcePubSubAdapterforSAPIntegrationSuite/overview

 

Cheers,

Punith Oswal

2 Comments
Labels in this area