Posts

Showing posts with the label CometD

LinkedIn

Salesforce Change Data Capture - Asynchronous Triggers and Subscription using MuleSoft & CometD

Image
 In this post, let us see what is Change Data Capture, when to use them and the different subscription approaches. 1. What is Change Data Capture Change Data Capture is similar to Platform Events. This can be used to keep your external system in sync with Salesforce data. It is supported for all custom Objects and some standard Objects.  The supported standard object list can be found here . Once enabled for a particular object, whenever that object record is created, updated, deleted or undeleted, an event will be fired to the event bus. This fired event will be available for 72 hours on the bus and an external application can subscribe to this. How it is different from Platform events? 1. In platform events, we can define our own fields and structure whereas CDC is applied on existing Objects 2. You can publish platform events from Flows, Apex, and process but CDC is fired by default on record changes How to Enable CDC? Go to setup->Integrations->Change Data Capture He...

OrderStatusChangedEvent - Salesforce Standard Platform Event fired during Order Status Changes

Image
 A sales process is normally completed by placing an order and contracting the products. In most cases, the actual ordering will be happening in an external system and not in salesforce. So in this case it is important to send order-related changes to the external system as soon as its status is updated in salesforce. Salesforce has introduced a new standard platform event to support this-  called  OrderStatusChangedEvent. This is available as part of API version 51.0 and above. Let us see this in detail: How to enable OrderStatusChangedEvent  Under Order Setting, we can enable this standard platform event: Setup->Feature Settings->Sales->Order Setting->Enable Order Events When this will be fired? This standard platform event will be fired when: 1. Status is updated for an existing order Supported Subscribers OrderStatusChangedEvent can be subscribed internally and externally. Subscribing through Flows Let us see an example of how to subscribe t...

Subscribing to Salesforce Platform Events using External Java Client - CometD

Image
Platform Events follow event based Architecture, where multiple subscribers can subscribe to a published event in real time manner.  Below diagram shows the basic Architecture of the event-based communication Model: Event - This is a change in state for a business process Event Message - Data about the event Producer - Publisher of the event Event Bus - A communication and storage service for published events Event Consumer - A subscriber to the channel Platform events can be subscribed internally and also externally Platfrom events  - Internal Subscription Below are some scenarios in which you can consume platform events internally: 1. When we need to execute functionalities asynchronously to save govornor limits 2. To build a proper exception logging framework - You can find more details here  How to subscribe Internally? we can see more details about this in a different blogpost. Platfrom events  - External Consumption Many Organizations are moving to event-bas...