Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

User Stories 

...

  • clientId: Client ID from the connected app

  • cllientSecret: Client Secret from the connected app

  • username: Username

  • password: Password

  • loginUrl (default is https://login.salesforce.com/services/oauth2/token) For Salesforce sandbox runs login url is different. That's why user needs this option.

  • objects - list of object's API names (For example: Task for base object and Employee__c for custom) separated by ",". If list is empty then subscription for all events will be used.

  • Event offset - Possible values are: "Earliest" or "Latest" (default). "Earliest" allows to get event for last 3 days (Salesforce stores events only for last 3 days), "Latest" subscribes for new events.
  • Handle errors -
  • Possible
  •  Possible values are: "Skip on error" or "Fail on error". These are strategies on handling records which cannot be transformed. "Skip on error" - just skip, "Fail on error" - fails the pipeline if at least one erroneous record is found.
  • objects - list of object's API names (For example: Task for base object and Employee__c for custom) separated by ",". If list is empty then subscription for all events will be used.

Example JSON

Code Block
{
        "name": "CDCSalesforce",
        "plugin": {
        "name": "CDCSalesforce",
        "type": "realtimesource",
        "label": "CDCSalesforce",
        "properties": {
           "clientId": "XXXXXXX",
           "clientSecret": "XXXXXXXXX",
           "username": "XXXXX",
           "password": "XXXXX",               
           "loginUrl": "https://login.salesforce.com/services/oauth2/token",
		   "objects": "XXXXX,XXXXX",
           "handleErrorseventOffset": "Skip on errorLatest",
		   "objectshandleErrors": "XXXXX,XXXXXSkip on error"
         }
       }
 }


DML

We subscribe for appropriate topics to get events for entities when something changes in database.

...

Then we will compare response with previous info about entity, if it exists, and send change event if necessary. If there is no previous info, than create event will be sent.


Implementation

Salesforce CDC API will be used for realtime plugin.

Cometd BayeuxClient is used to subscribe to events.