Operator-managed Change Data Capture (CDC) is available starting with Operator version 0.9.0.
- Capturing changes made to documents in Big Peer
- Filtering these changes based on your configuration
- Publishing them to Kafka topics for consumption by external systems
Prerequisites
Before setting up CDC, ensure you have:- Deployed a Big Peer using the Ditto Operator (version 0.9.0 or above)
- Created a Big Peer App
Creating a Kafka Data Bridge
To create a Kafka data bridge, you need to have aBigPeer deployed and a BigPeerApp associated with it. Once those requirements are met, you can create your data bridge as follows:
example-data-bridge, associated with the example-app BigPeerApp from the quickstart guide.
BigPeerDataBridge resources must include both the ditto.live/app: <big-peer-app-name> and ditto.live/big-peer: <big-peer-name> labels.Filtered vs Unfiltered Bridges
You can create either filtered or unfiltered data bridges:-
Filtered Bridge: Captures only changes to specific collections matching your query
-
Unfiltered Bridge: Captures all changes across your entire app
Topic Partitions
ThetopicPartitions field allows you to customize the number of Kafka topic partitions (from 1 to 100). Choose this value based on your expected throughput and number of consumers:
- 12 partitions (default): Good for most use cases, allows 1, 2, 3, 4, 6, or 12 parallel consumers
- 24-60 partitions: For higher throughput workloads
Connecting to CDC
To connect to CDC Kafka topics, you’ll need to extract the necessary metadata and credentials. In the examples below, these will be saved to local files for later use. For production environments, make sure to store credentials securely.Extracting Credentials
First, fetch the connection info from theBigPeerDataBridge status:
Cluster Certificate and Password
Extract the cluster certificate and its password from the Kubernetes secret referenced instatus.kafka.certificateSecretRef.cluster.name.
Topic and Group ID Prefix
The topic name is available instatus.kafka.topic.
The Kafka topics use a group ID prefix, so multiple consumer groups can read from the topic independently. This prefix is available in status.kafka.consumerGroupPrefix.
User Certificate and Password
Extract the user certificate and password from the Kubernetes secret referenced instatus.kafka.certificateSecretRef.user.name.
Connecting to Kafka
With all the required connection information extracted, you can now connect a consumer to the topic. See the Change Data Capture documentation for guidance on which parameters to configure in your consumer with this information.1
Identify your endpoint
The endpoint to connect to is available in
status.kafka.endpoint.If you’ve followed the quickstart guide, it will be:2
Run the console consumer
Now we can run the console consumer, supplying the user certs, cluster certs, topic and a group ID using the group prefix.If the console runs without error, then you’ve successfully connected.
3
Verify changes are streaming
The easiest way to verify that changes are streaming successfully is by inserting a document through the HTTP API.If you haven’t already, follow the steps in Using the Big Peer HTTP API to create an API key.Example document insertion:You should see output in your Kafka consumer like:
Deleting a Data Bridge
To delete a data bridge:Learn More
For more information on CDC concepts, see the Change Data Capture documentation, which covers:- Consumer Groups - running multiple consumers in parallel
- CDC Events Explained - understanding event types and ordering guarantees
- Partitioning Strategies - optimising throughput