The cdc_event function within the mock-jutsu library is a specialised tool designed to facilitate the generation of high-fidelity Change Data Capture (CDC) events. For developers building event-driven architectures or synchronising distributed databases, having access to realistic mock data that mimics the Debezium standard is essential. This function streamlines the creation of complex JSON payloads that represent row-level changes in a source database, allowing engineers to simulate data flow without needing a live database connection or an active Kafka Connect cluster. By providing a consistent structure, it helps ensure that downstream consumers are prepared for the nuances of real-time data streams.
Strictly adhering to industry-standard formats, the cdc_event utility generates structured objects containing the necessary metadata and state transitions required for robust integration testing. Every generated event includes an operation code—such as 'c' for create, 'u' for update, or 'd' for delete—alongside a millisecond-precision timestamp (ts_ms) and source information identifying the database and table. Crucially, the function populates 'before' and 'after' payloads, providing a comprehensive snapshot of data evolution. By using mock-jutsu to produce this test data, developers ensure their downstream consumers, such as Apache Flink jobs or custom microservices, can handle state changes with absolute precision and reliability.
In practice, the cdc_event function is invaluable for stress-testing data pipelines and validating complex transformation logic. Whether you are verifying how your application handles an out-of-order update or testing the resilience of a data warehouse ingestion process, this tool provides the flexibility needed for modern DevOps workflows. It supports multiple interfaces for maximum convenience: developers can invoke it via the Python API using jutsu.generate('cdc_event'), execute it through the CLI for quick prototyping with "mockjutsu generate cdc_event", or integrate it directly into performance tests using the JMeter plugin via the ${__mockjutsu(cdc_event,)} syntax. This versatility significantly reduces the time spent on manual data preparation.
Ultimately, integrating cdc_event into your local development and CI/CD pipelines ensures that your event-sourcing infrastructure is battle-tested against realistic scenarios. By providing a reliable way to generate test data that mirrors production-grade Debezium outputs, mock-jutsu empowers engineers to build more resilient, data-aware applications. The ability to simulate complex database operations on demand, including the nuances of primary key updates and record deletions, makes it an indispensable asset for any technical team working with streaming data or real-time analytics in a modern cloud environment.
mockjutsu generate cdc_eventmockjutsu bulk cdc_event --count 10mockjutsu export cdc_event --count 10 --format jsonmockjutsu export cdc_event --count 10 --format csvmockjutsu export cdc_event --count 10 --format sqlfrom mockjutsu import jutsujutsu.generate('cdc_event')jutsu.bulk('cdc_event', count=10)jutsu.template(['cdc_event'], count=5)${__mockjutsu_event_sourcing(cdc_event)}# JMeter Function: __mockjutsu_event_sourcing# Parameter 1: cdc_event# Parameter 2: (not required for this function)GET /generate/cdc_event# → {"type":"cdc_event","result":"...","status":"ok"}GET /bulk/cdc_event?count=10POST /template {"types":["cdc_event"],"count":1}