Skip to main content

Cinchy Event Broker/CDC

Overview

The Cinchy Event Broker/CDC (Change Data Capture) source allows you to capture data changes on your table and use these events in your data syncs.

  • The Cinchy CDC will trigger on things like adding, updating, or deleting a cell/group of cells.
  • The Cinchy CDC will trigger on row approvals, but not individual cell approvals.

To listen to a table, the "Publish Data Change Notifications" capability must be enabled. You can do so via Design Table > Change Notifications.

Publish Data Change Notifications

Use case

To mitigate the labour and time costs of hosting information in a silo and remove the costly integration tax plaguing your IT teams, you want to connect your legacy systems into Cinchy to take advantage of the platform's sync capabilities.

To do this, you can set up a real-time sync between a Cinchy Table and Salesforce that updates Salesforce any time data is added, updated, or deleted on the Cinchy side. If you enable change notifications on your Cinchy table, you can set up a data sync and listener config with your source as the Cinchy Event Broker/CDC.

tip

The Cinchy Event Broker/CDC supports both batch syncs and real-time syncs (most common).

Remember to set up your listener config if you are creating a real-time sync. In Cinchy v5.7+ this can be done directly in the Connections UI, however for multiple listener requirements you must still add additional configurations in the Listener Config table.

Info tab

You can find the parameters in the Info tab below (Image 1).

Values

ParameterDescriptionExample
TitleMandatory. Input a name for your data syncCDC
VariablesOptional. Review our documentation on Variables for more information about this field.
PermissionsData syncs are role based access systems where you can give specific groups read, write, execute, and/or all the above with admin access. Inputting at least an Admin Group is mandatory.

Image 1: The Info Tab

Source tab

The following table outlines the mandatory and optional parameters you will find on the Source tab (Image 2).

The following parameters will help to define your data sync source and how it functions.

ParameterDescriptionExample
SourceMandatory. Select your source from the drop-down menu.Cinchy Event Broker/CDC
Run QueryOptional. If true, executes a saved query. Uses the Cinchy ID of the changed record as a parameter. See Appendix A for more.
Path to IterateOptional. Provides the JSON path to the array of items you want to sync. Applicable if your event message contains JSON values.

Image 2: The Source Tab

Next steps

Appendix A - source parameters

The following sections outline more information about specific parameters you can find on this source.

Run Query

The Run Query parameter is available as an optional value for the Cinchy Event Broker/CDC connector. If set to true it executes a saved query; whichever record triggered the event becomes a parameter in that query. Thus the query now becomes the source instead of the table itself. You are able to use any parameters defined in your listener config.

In Cinchy v5.14+, you are able to define whether Run Query executes as a Batch or as an Event. (Prior to v5.14, Run Query would always execute as Event.) For instance, in a sync where the worker collects a batch of 20 messages:

Using the Event flag: the specified query is run 20 times, once for each record in the topic batch.

Using the Batch flag: the specified query is run only once, for the entire topic batch at a time.

Image 3: Run Query

Example

The example below is a data sync using the Event Broker/CDC as a source. Our Listener Config has been set with the CinchyID attribute (Image 4).

Image 4: Run Query

We can enable the Run Query function to use the saved query "Get Configuration" as our source instead. Note that the query is slightly different for a Batch vs Event query as @parameters do not work with IN statements.

// "Get Configuration - Event" Query

SELECT Name, [Cinchy Id]
FROM [HR].[Employees]
WHERE [Cinchy Id] = @param1
AND [Deleted] IS NULL
// "Get Configuration - Batch" Query

SELECT Name, [Cinchy Id]
FROM [HR].[Employees]
WHERE [Cinchy Id] IN ({0})
AND [Deleted] IS NULL

If we change the data in our source table to trigger the event, the query parameters below show that the Cinchy ID of the changed record(s) will be used in the query. This query is now our source.

Query parameters for Event execution:

  • This is the default behaviour for platform version earlier than v5.14.
// Event Query Parameters

{
"@param1" : "Cinchy Id"
}

Image 5: Run Query

Query parameters for Batch execution:

  • The parameter names must follow the convention 0, 1, etc.
  • Parameter keys must be unique.
// Batch Query Parameters

{
"{0}" : "Cinchy Id"
}

Image 5: Run Query

In this case, the parameter in the query will be replaced with multiple values from a batch, and separated by a comma. In case where the batch has 20 messages, the query would be transformed to contain 20 comma separated Cinchy IDs:

SELECT Name, [Cinchy Id]
FROM [Test].[Example Table]
WHERE [Cinchy Id] = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
AND [Deleted] IS NULL

Appendix B

Old vs new filter

The Cinchy Event Broker/CDC Stream Source has the unique capability to use "Old" and "New" parameters when filtering data. This filter can be a powerful tool for ensuring that you sync only the specific data that you want.

The "New" and "Old" parameters are based on updates to single records, not columns/rows.

"New" example:

In the below filter, we only want to sync data where the [Approval State] of a record is newly 'Approved'. For example, if a record was changed from 'Draft' to 'Approved', the filter would sync the record.

info

Due to internal logic, newly created records will be tagged as both "New" and "Old".

"filter": "New.[Approval State] = 'Approved'

"Old" example:

In the below filter, we only want to sync data where the [Status] of a record was 'In Progress' but has since been updated to any other [Status]. For example, if a record was changed from 'In Progress' to 'Done', the filter would sync the record.

info

Due to internal logic, newly created records will be tagged as both "New" and "Old".

"filter": "Old.[Status] = 'In Progress'