Use Apache Kafka-powered Change Data Capture (CDC) to enable real-time event streaming from Ditto Cloud to your applications and third-party data solutions.
WHERE
clause.For example, to filter only blue cars, specify: color = 'blue'
.Or, to stream all data in the specified collection, set the query to true
.You can test your query within the editor before creating your Data Bridge and preview the results.SSL Connection | Ditto Name | Description |
---|---|---|
ssl.truststore.location | Cluster certificate | Certificate authority (CA) certificate in PKCS12 format. |
ssl.truststore.password | Cluster certificate password | Password to decrypt the CA certificate. |
ssl.keystore.location | User certificate | Location of user certificate in PKCS12 format. |
ssl.keystore.password | User certificate password | Password to decrypt the user certificate. |
bin
directory of Kafka version you’ve downloaded, for example: kafka_2.13-3.9.0/bin
.
INSERT
a document that matches the filter of your Data Bridge.For example, given a Data Bridge with a filter of:cars
color = 'blue'
INSERT INTO cars DOCUMENTS ({ 'color': 'blue' })
Alternatively, you can trigger changes by performing an INSERT
with the SDK or HTTP APItxnId
and the document’s _id
. As no two events for a given document will share the same tnxId
, when combined, they can be used to deduplicate events received from both streams.
Example
e18540db-85a7-4079-8fad-c486190a752a
and consumer group prefix 1e3a1a13-93d7-48ce-8633-c82b78d48451
, our getting started example could be adapted to run in two independent consumer groups with the following:A
and B
:
UPDATE cars SET color = 'blue' WHERE _id = 'A'
UPDATE cars SET color = 'red' WHERE _id = 'B'
UPDATE cars SET color = 'green' WHERE _id = 'A'
{'_id': 'A' , 'color': 'green'}
and {'_id': 'B' , 'color': 'red'}
Field | Description |
---|---|
txnID | The timestamp for when Ditto Server internally replicates data modifications from small peers. (This timestamp is an always‑increasing value.) |
type | The type of event stream. |
collection | The collection that the changed document belongs to. |
change.method | The method that executed the event. |
change.oldValue | The previous contents of the document |
change.newValue | The current contents of the document |
INSERT
DQL operation) an upsert
CDC event is created.
A new upsert
event will look something like the following:
upsert
event are as follows:
Field | Description |
---|---|
change.oldValue | The previous state of the document; since the document did not previously exist, the change.oldValue field is always set to null . |
change.newValue | The current state of the document created as a result of the upsert operation |
UPDATE
DQL operation) an update
CDC event is created.
Given a document with the following:
update
operation specified the following changes:
update
event.
Field | Description |
---|---|
change.oldValue | The previous state of the document. |
change.newValue | The current state of the document (note, this the full document, not the diff of the change) |
TOMBSTONE
DQL operation) an remove
CDC event is created.
A new remove
event will look something like the following:
Field | Description |
---|---|
change.value | Indicates the full document at the time of its removal. |
evict
CDC event is created.
A new evict
event will look something like the following:
value
field will be null
.
Field | Description |
---|---|
change.value | Indicates the full document at the time of its eviction. null if the document has been already deleted. |
requeryRequired
event type
displays in your Kafka console.
Following is an example of a requeryRequired
event stream:
documents
field is now deprecated and will only return an empty list, as demonstrated in the previous snippet.requeryRequired
message, invoke the HTTP API to update your system for the entire dataset, as specified in your Data Bridge’s filter.
Use the event’s txnID
as a value of X-DITTO-TXN-ID
in the HTTP API call to ensure the data retrieved is not stale.
Ditto-Signature
header.You can inspect this in your webhook’s logic to verify the authenticity of the request, ensuring that it comes from your Ditto Data Bridge.