Salesforce Subscriber

Salesforce Subscriber

In this article

Overview

The Salesforce Subscriber Snap is a Read-type Snap that enables subscribing to the CometD channels of the Salesforce Platform to read Custom Platform events and Change Data Capture (CDC) events for standard and custom Salesforce objects. The Snap also enables subscribing to custom channels where Salesforce’s enterprise users broadcast real-time updates on their Salesforce objects.

Salesforce-Subscriber-Overview.png

 

Supported Salesforce Events

  • Custom Platform events: User-defined read/write events. These events end with "__e".

  • CDC events: Read-only events created when the Salesforce objects (standard or custom) change. These events end with "ChangeEvent" or "__ChangeEvent".

  • Custom channels: Streams of select event messages, of either platform event type or CDC event type. These topics end with __chn.

There are two underscore characters in __e, __ChangeEvent, and __chn.

Prerequisites

  • Ensure that Change Data Capture is enabled for the target entities. Log in to your Salesforce instance and navigate to Setup → App Setup → Develop → Change Data Capture. 

  • Ensure that Field Tracking is enabled for the selected entities.

  • Account must have valid access permissions.

Limitations and Known Issues

  • For a Salesforce (Platform Events) Subscriber Snap, retry attempts are not logged, and currently, retries are attempted only for authentication errors.

  • Salesforce imposes a limit on the number of subscriptions. See Change Data Capture Allocations for details.

  • Supports only Platform and CDC events.

Behavior Change

From the 4.30 release onwards, the Snap stops and reports the error immediately when it encounters the daily limit exceeded error. Earlier, the Snap reported an error and stopped only at the next resubscribe attempt when it encountered the daily limit exceeded error.

Support for Ultra Pipelines

Works in Ultra Pipelines.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input

Document

  • Min:0

  • Max:1

  • JSON Parser

  • Mapper

This Snap at the most can have only one input document that contains data to be listened on a Salesforce object.

Output

Document

  • Min:1

  • Max:1

  • JSON Formatter

  • Mapper

A document with Map data that contain the individual records subscribed on the given Salesforce object and/or original fields.

Snap Settings

Field

Field Type

Description

Field

Field Type

Description

Label*


Default Value: Salesforce Subscriber
Example: Salesforce Subscriber

String

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

 

Service Version*


Default value: 52.0
Example: 52.0

String/Expression

Specify the version number of the Salesforce service that you want to connect to.

Salesforce platform event is supported in version 44.0 or later.

 

Topic*


Default Value: N/A
Example:

  • Printer_Event__e

  • AccountChangeEvent

String/Expression

Specify the topic (Salesforce Platform event, CDC event, or custom channel) to subscribe to. This is a suggestible field that lists the Platform Events and CDC events available to you.  You can select the name from the suggested list. The supported Salesforce events are:

  • Standard Platform events:

  • Platform events: User-defined read/write events. These events end with "__e".

  • Custom channels: Events that end with __chn. Channel events are available starting from service (API) version 47.0.

Custom channel names are case-sensitive.

Custom channel type

 

Default Value: CDC
Example: Event

Dropdown list

Choose a custom channel type - Event (for events) or CDC (for data) if the chosen topic is a custom channel that ends with __chn.

Custom channel type values are case-sensitive.

Replay ID*


Default Value: -2
Example: 20

Integer/Expression

Specify the position of an event in the event stream. The Snap supports the following IDs:

  • -2: Receives events from the earliest event position in the stream.

  • -1: Receives events from the latest event position in the stream.

  • A specific positive value ID: Receives events after the specified positive ID value.

If you stop a Pipeline execution, the Replay ID is lost and the Snap restarts from the position you input here.

The Snap automatically sets the Replay ID value to -2 when:

  • the specified Replay ID is invalid or outside the retention window.

  • the CreatedDate of the most recent event received by Snap is outside the 72-hour retention window.

Message Count*


Default Value: -1
Example: 2

Integer/Expression

Specify the number of messages required to read and complete the Pipeline execution.

If the value is set to -1, the Snap waits indefinitely and reads messages whenever available until you manually stop the pipeline execution.

 

Pass Through


Default Value:  Not Selected

Checkbox

Select this checkbox to pass the input document the output view under the key 'original'.

If you deselect this checkbox, the input document will not be passed and there is no "original" key in the output document.

 

Advanced Properties

Use this fieldset to configure Http Long Polling.

Properties


Default Value: N/A
ExamplemaxNetworkDelay, maxMessageSize

String

Specify the property or select from the suggestion list.

 

Values

Default Value: N/A
Example50000

String

Specify the value for the property.

 

Snap Execution


Default Value: Validate & Execute
Example: Execute only

Dropdown list

Select one of the following three modes in which the Snap executes:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Troubleshooting

Error

Reason

Resolution

403::Handshake denied; 401::Request requires authentication

Client is not authorized to access the server due to either a domain mismatch or authentication failure.

Configure the Enhanced Domain in the Instance URL property to ensure authentication for successful access to the server.

Unable to subscribe to topic <channel name>. Reason: 400::The channel specified is not valid

The Topic value does not exactly match the full name of the custom channel. OR

Check the spelling of the provided channel, including the matching case, and ensure it ends with __chn.

Incorrect Custom channel type is selected.

Select the appropriate channel type from the list - CDC for custom channels of type ‘data’ and Event for custom channels of type ‘event.’

Example

Process Platform Events in Salesforce

This example Pipeline demonstrates how the Salesforce Subscriber Snap processes platform events. The following Salesforce Subscriber Snap shows how the Snap is configured and how the Salesforce object's records are read.

You can see that the Replay ID is -2. So the Snaps reads messages from the beginning. And the Snap reads only 3 messages as the Message count is set to 3.The Snap processes the events and the output preview is as follows:

Download this Pipeline.

Process Salesforce events through custom channels

This example pipeline depicts configuring a Salesforce Subscribe Snap to read event information from a Salesforce custom channel.

example-salesforce-subscribe-channel.png

For this example, a series of create, update, and delete actions are consecutively performed on a Lead object in Service (API) version 52.0. This example presumes an appropriate account configuration for the Snap.

This Snap is configured to:

  • Read the channel topic singleCDC1ReplayidStandardObj__chn of type CDC, where these updates are logged.

  • Use the Salesforce API version 60.0 with the Replay ID set to -1

  • Read only three (3) messages (for a compact JSON preview in the Snap’s output).

Snap configuration

Snap output preview

Snap configuration

Snap output preview

example-salesforce-subscribe-channel-snap-config.png
f2fd4eff-efc2-4c41-ad8d-80bbb06f9541.png

Upon validation of this pipeline, the Snap’s output preview gets information on three recent events - create, update, and delete actions in that sequence, from the CDC data in the selected topic/channel. The snapshot of the output preview above shows these three events (replayids) with the update event expanded to depict the details.

Download this pipeline.

Downloads

Snap Pack History