Skip to main content

Celonis Product Documentation

Salesforce Streaming Connection

Overview

Leverage Celonis' out-of-the-box Salesforce connectivity to integrate the Celonis EMS with your organization's Salesforce Lightning Platform. Salesforce offers a cloud-based platform which covers a wide range of customer relationship management (and complementary) solutions, including CRM, customer service/support, marketing automation, analytics and application development solutions. Across all solutions, the customizable platform serves as a single source of truth for all customer data.

The Salesforce Streaming Cockpit by Celonis is based on an event-driven architecture that creates a direct channel between Salesforce and Celonis. Salesforce Platform Events and the Salesforce EventBus are at the core of that architecture.

Every time a Salesforce record in a relevant object is inserted, updated or deleted, Apex triggers capture that operation. The Apex trigger then creates a list of all event objects it received and publishes the captured Salesforce Platform Event to the Salesforce EventBus. At the same time, the Celonis streaming service subscribes to the EventBus through a defined channel (which is identical to the Platform Event name) to receive streaming data that includes the following fields for each Platform Event:

Standard Platform Event fields

  • Created By: user who created the event.

  • Created Date: the event’s creation date.

  • Replay ID: unique identifier for each event within a channel.

Additional custom fields created by Celonis

  • Operation(Text): information about the operation (insert, update or delete)

  • body(Long Text Area): complete changed record (serialized to JSON)

50724899.png

Consequently, each Salesforce object that the streaming connection should cover requires a dedicated Apex trigger. Apex triggers for the most common objects are already included in an unmanaged package provided by Celonis. In addition to Apex triggers, that package includes relevant Platform Events and Apex classes. It can be conveniently installed by Celonis users within a few clicks via a direct link in their Celonis Salesforce Streaming Data Connection configuration UI.

Besides the Apex triggers, the package includes two Apex classes:

  1. CelonisUtils- code used by all triggers to, e.g., build a list of events to be published or serialize changed rows to JSON

  2. Trigger tests(for each Apex trigger) - tests for individual triggers

The packaging and distribution approach described above makes the Salesforce-side setup and configuration of the streaming connection both convenient (relevant components are included out-of-the-box in a package which can be installed via a direct link) and transparent (all package components, incl. their underlying code, can be viewed and changed by the user if required). To install the Celonis unmanaged package on their Salesforce system, users require permission to install packages and Download AppExchange Packages[1].

Deep-Dive Salesforce EventBus Subscription

All events that the Apex triggers publish to the EventBus are persisted for a finite time period (24 hours minimum depending on the Salesforce setup [2]) before they expire and are no longer available. Publishing to and consuming from the EventBus are decoupled. Authentication is based on OAuth, as for the “standard” (not streaming) data connection between Celonis and Salesforce.

Celonis subscribes to the EventBus associated with the Platform Event using EMP Connector, an open-source tool to subscribe to events using CometD.

CometD is a scalable, HTTP-based event routing bus that uses an AJAX push technology pattern known as Comet. It implements the Bayeux protocol. Comet programming, also called long polling, allows emulation of an information push from a server to a client. Similar to a normal poll, the client connects and requests information from the server. However, instead of sending an empty response if information isn't available, the server holds the request and waits until information is available (an event occurs). The server then sends a complete response to the client. The client then immediately re-requests information. The client continually maintains a connection to the server, so it is always waiting to receive a response. In the case of server timeouts, the client connects again and starts over.

Deep-Dive Celonis Streaming Service

The Celonis streaming service is based on the concept of subscription. When starting the subscription in the Celonis Streaming Cockpit’s UI, Celonis starts listening for new events to be received from a Salesforce Platform Event. When stopping the subscription, Celonis stops listening for new events. To get metadata for relevant Salesforce objects when the streaming connection is created, Celonis sends a metadata request via the regular Salesforce REST API (as for the “regular” Salesforce connection).

To integrate incoming event data into Celonis users’ Data Pools, a scheduler transforms received event data and creates a push job to push the transformed data into Celonis tables. That scheduler currently runs every minute by default (interval will be configurable by users going forward).

Besides that, Celonis logs received records, as well as potential exceptions during the process.

Salesforce Platform Event Limits

Depending on the type of Salesforce instance you are using, there are different Event limits in place on the Salesforce side, which affect the usage of the Streaming connector. Each change on an object for which a trigger is in place will count as one event, i.e. if there are 30,000 changes on the Opportunity object in a 24 hour period, this will lead to 30,000 delivered events.

For example, when using a Performance or Unlimited Edition, there is a limit of publishing 50,000 events in a 24 hour period. Depending on how many triggers are installed besides the one coming with the Celonis package, not the whole 50,000 will be available for consumption for the Celonis Streaming extractor.

If the limit is exceeded, the Celonis Streaming extractor will throw the following error: 403::Organization total events daily limit exceeded.

In order to avoid that, you can either remove certain triggers for objects which are not real-time critical or increase the Event limit on Salesforce side by purchasing a High-Volumne Platform Event Add-On License (https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_event_limits.htm). This will increase the Event Delivery limit by 100,000 to 150,000.

55707214.png
References

[1]:https://help.salesforce.com/articleView?id=sf.distribution_installing_packages.htm&type=5(last accessed in May 2021)

[2]:https://resources.docs.salesforce.com/228/latest/en-us/sfdc/pdf/platform_events.pdf(last accessed in May 2021)

[3]:https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_event_limits.htm (last accessed in September 2021)