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.

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.

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 here 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

Batches and per-message values​

The worker reads messages from the listener in batches (up to WorkerBatchSizeLimit messages, 20 by default), and a batch runs through the sync as one unit. Two things follow:

  • A post-sync script runs once for each batch, not once for each message. In a script, @CinchyId and the other parameters taken from the message hold the value of one message only, the last one in the batch. A script that updates the row for @CinchyId marks one row for each batch and can look correct in a test with low volume. To work on every record in the batch, use @InsertedRecordIds() and @UpdatedRecordIds().
  • If any part of a batch fails, including a post-sync script that fails or times out, the batch isn't retried. Its messages are written to the worker's dead message log.

Run a batch of one message​

If a post-sync script needs each message's own values, make every batch hold a single message. A batch also ends when the next message has the same messageKeyExpression value as one already in it, so a constant expression in the listener's Topic JSON gives a batch of one for that listener only:

{
"tableGuid": "420c1851-31ed-4ada-a71b-31659bca6f92",
"fields": [
{
"column": "Cinchy Id",
"alias": "CinchyId"
}
],
"messageKeyExpression": "'one-at-a-time'"
}

This is better than lowering WorkerBatchSizeLimit to 1, which is a setting in the worker's appSettings.json and changes every real-time sync on that worker. Either way, throughput drops, because each message pays the full cost of a batch.

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.

The setting is runQueryPer (Run Query per in Connections), with the values Event (the query runs once for each message) and Batch (it runs once for each batch of messages). It defaults to Event.

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 "CDC Product Ticket Datestamps" as our source instead (Image 5). If we change the data from Record A in our source table to trigger our event, the Query Parameters below show that the Cinchy ID of Record A will be used in the query. This query is now our source.

Image 5: Run Query

It would appear in the data sync config XML as follows:

<CinchyEventBrokerDataSource runQuery="true" domain="Product" name="CDC Product Ticket Datestamp" parameters="{&quot;@id&quot;: &quot;Cinchy Id&quot; }">