
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.
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.
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
Setup page will be opened in a new tab, Search for "Integrations" in Quick Find then select "Change Data Capture"
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.
We are all set on the Salesforce, let go to SAP CI and configure the Sender Adapter now.
SAP CI Iflow:
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
Configuration of Salesforce Pub Sub Sender Adapter:
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 |
Port | Specify 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 ID | Specify 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:
|
Token URL | Specify 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 Name | Specify the User Credentials storing the username-password details. |
Security Token Alias | Specify 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). |
Audience | Specify 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 Alias | Specify the Secure Parameter that stores the username of the Salesforce user. |
Issuer Alias | Specify the Secure Parameter which indicates the OAuth client_id of the connected app in Salesforce for which the certificate was registered. |
Keystore Alias | Specify 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:
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:
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 :
After Change in Phone Number:
As soon the record is saved in the Salesforce, the event/message is generated which is received by SAP CI
Response Payload :
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://api.sap.com/package/SalesforcePubSubAdapterforSAPIntegrationSuite/overview
Cheers,
Punith Oswal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
5 | |
4 | |
4 | |
3 | |
3 | |
2 | |
2 |