Subscribing to Event Streams

1. Listener Configs Table Columns

To subscribe to an event stream, make sure you have a Cinchy Listener running connected to the Cinchy instance you are on. You will need to create a record in the Listener Configs table and Enable it to subscribe to events.

Column

Value

Event Connector Type

Choose the connector type

Topic

Refer to the topic JSON of the connector type you are configuring.

Connection Attributes

Refer to the connection attributes JSON of the connector type you are configuring.

Status

Make sure you set the value to Disabled when creating the config for the first time. This will give you a chance to correctly configure the listener before it is picked up by the service. After configuring the listener correctly you should flip the value to Enabled.

Data Sync Config

CLI Sync Configuration you want to use to sync records from your real time sync.

Subscription Expires On

This field is a timestamp that is populated by some Event Listeners (eg. Salesforce) service when it has successfully subscribed to a topic.

Message

If there are any errors in the configuration, the Event Listener will disable the topic and write the error message here.

Auto Offset Reset

Earliest, Latest or None. In the case where the listener is started and either there is no last message ID, or when the last message ID is invalid (due to it being deleted or it's just a new listener), it will use this column as a fallback to determine where to start reading events from.

Earliest will start reading from the beginning on the queue (when the CDC was enabled on the table). This might be a suggested configuration if your use case is recoverable or re-runnable and if you need to reprocess all events to ensure accuracy. Latest will fetch the last value after whatever was last processed. This is the typical configuration. None will not read start reading any events. You are able to switch between Auto Offset Reset types after your initial configuration through the below steps: 1. Navigate to the Listener Config table. 2. Re-configure the Auto Offset Reset value. 3. Set the "Status" column of the Listener Config to "Disabled". 4. Navigate to the Event Listener State table. 5. Find the column that pertains to your data sync's Listener Config and delete it. 6. Navigate back to the Listener Config table. 7. Set the "Status" column of the Listener Config to "Enabled" in order for your new Auto Offset Reset configuration to take effect.

Name

User-friendly display name

2. Testing an Event Stream

Once you have created your listener configuration, you can switch the status to Enabled. If there is a Cinchy Listener running pointing to this Cinchy Platform instance, it will attempt to subscribe to the specified event stream.

3. Listener Topics - Additional Attributes

The following attributes may be used in the Listener Config Topic column.

3.1 messageKeyExpression

Each of your Event Listener message keys a message key. By default, this key is dictated by the Cinchy ID of the record being changed.

When the worker processes your Event Listener messages, it does so in batches, and for efficiency and to guarantee order, messages that contain the same key will not be processed in the same batch.

The messageKeyExpression property allows you to change the default message key to something else.

Possible Use Case

  • Ensuring records with the same message key can be updated with the proper ordering to reflect an accurate collaboration log history.

Example Syntax

In this example, we want the message key to be based on the [Employee Id] and [Name] column of the table that CDC is enabled on.

{ "messageKeyExpression": "CONCAT(New.[Employee Id], '-', New.[Name])", … }

Last updated