Capturing CDC Changes in Aternity


Aternity is a digital experience management platform that provides insights into user interactions with applications and services. Capturing Change Data Capture (CDC) changes in Aternity allows organizations to monitor and analyze data modifications in real-time, enabling proactive decision-making and performance optimization.

In this article, we'll explore how to integrate CDC changes into Aternity for enhanced visibility and analysis: Understanding Change Data Capture (CDC) in Database Systems

Integration Overview: Integrating CDC changes into Aternity involves leveraging Aternity's data ingestion capabilities to capture and process CDC data from the source database. This process typically includes configuring the CDC source, defining the data extraction method, and configuring Aternity to consume and analyze the CDC data.

Step-by-Step Integration Process

Step 1. Configure CDC Source

First, ensure that CDC is properly configured on the source database. This involves enabling CDC on the database and relevant tables, as outlined in the database documentation.

-- Enable CDC on the database
EXEC sys.sp_cdc_enable_db;

-- Enable CDC on a specific table
EXEC sys.sp_cdc_enable_table
    @source_schema = N'dbo',
    @source_name = N'MyTable',
    @role_name = NULL,
    @supports_net_changes = 1;

Step 2. Extract CDC Data

Next, extract CDC data from the source database using an appropriate method. This may involve querying the CDC tables directly or using database connectors or middleware tools to retrieve the CDC changes.

public List<CDCChange> GetCDCChanges()
    List<CDCChange> changes = new List<CDCChange>();
    using (var connection = new SqlConnection(connectionString))
        SqlCommand command = new SqlCommand("SELECT * FROM cdc.dbo_MyTable_CT", connection);
        SqlDataReader reader = command.ExecuteReader();
        while (reader.Read())
            // Parse CDC change data and populate CDCChange object
            CDCChange change = new CDCChange();
            change.Operation = (CDCOperation)reader["__$operation"];
            change.TableName = (string)reader["__$tablename"];
            // Populate other CDC change properties
            // ...
    return changes;

Step 3. Transform and Enrich Data

Transform and enrich the extracted CDC data as needed to meet the requirements of Aternity. This may involve mapping CDC changes to Aternity's data schema, applying data transformations, and enriching the data with additional context or metadata.

public AternityData TransformCDCData(List<CDCChange> changes)
    AternityData aternityData = new AternityData();
    foreach (var change in changes)
        // Transform CDC change into AternityData format
        AternityEntry entry = new AternityEntry();
        entry.OperationType = change.Operation.ToString();
        entry.TableName = change.TableName;
        // Map other properties
    return aternityData;

Step 4. Ingest Data into Aternity

Ingest the transformed CDC data into Aternity using the platform's data ingestion capabilities. This typically involves configuring data connectors or APIs to receive and process the CDC data streams.

public async Task<bool> IngestDataIntoAternity(AternityData data)
    // Serialize AternityData object to JSON
    string jsonData = JsonConvert.SerializeObject(data);
    // Send HTTP POST request to Aternity API endpoint
    using (var httpClient = new HttpClient())
        var response = await httpClient.PostAsync("", 
                                                   new StringContent(jsonData, Encoding.UTF8, "application/json"));
        return response.IsSuccessStatusCode;

Step 5. Analyze and Visualize Data

Once the CDC data is ingested into Aternity, leverage the platform's analytics and visualization tools to analyze and visualize the data. This may include creating dashboards, reports, and alerts to monitor CDC changes in real-time and identify performance trends and anomalies.

Benefits of Capturing CDC Changes in Aternity:

  1. Real-time Insights: By capturing CDC changes in Aternity, organizations gain real-time insights into data modifications, enabling proactive monitoring and troubleshooting.
  2. Performance Optimization: Analyzing CDC data in Aternity allows organizations to identify performance bottlenecks and optimize application and database performance.
  3. Root Cause Analysis: Aternity's analytics capabilities enable organizations to perform root cause analysis on CDC-related issues, facilitating rapid resolution and minimizing downtime.
  4. Enhanced Visibility: Integrating CDC changes into Aternity provides comprehensive visibility into data modifications across the organization, ensuring data integrity and compliance.


Capturing Change Data Capture (CDC) changes in Aternity enhance organizations' ability to monitor, analyze, and optimize data-related processes in real-time. By integrating CDC data into Aternity's digital experience management platform, organizations can gain valuable insights into data modifications, improve performance, and ensure data integrity and compliance.

By following these steps and integrating the provided code snippets, you can capture CDC changes from your database and ingest them into Aternity for analysis and visualization. Remember to adapt the code to your specific database and Aternity environment, and consider error handling and security best practices in your implementation.

Aternity data into a Kafka topic and consume those changes as messages