To use CDC with Stambia, you need to download a dedicated component (since S20) or CDC templates (in the Stambia versions older than S20).

When activated on a table, CDC allows you to consume only the changes (inserts, deletes, updates) that were made since the last execution of your mapping.

Activation of CDC on a table

You need to create a process that will initialize CDC on the template of your choice.

Let's say we want to activate CDC on a table T_CUSTOMERS (from the demo HSQL database included in your designer's installation).

1. After the component CDC is installed in your designer you will find the tools necessary to activate CDC on a table in the Palette in the category Tools.

Drop the one that applies to your database in a new process (in our example it will be "CDC-HSQL")

2. Drag and drop the table on which you want to activate CDC (in our case T_CUSTOMER) on the tool and rename the link to "REF"

3. Check the options on the template:

  • make sure that the "CDC operation" is start
  • choose the name of the subscriber (this is the name you will then use on your mapping) by default it is "defaultSubscriber". 

You can add as many subscribers as you wish, for example if you have two different mappings that will use this table as a source you will need a subscriber for each of them

  • choose whether you want to track inserts, updates, and deletes (by default all are activated)

4. Execute the process, the tool will create the CDC tables and associated triggers

Using CDC table in a mapping

Once CDC activated on a table we can easily switch between using this table in a standard mode and in the CDC mode.

While using it in the standard mode all the records from the source table are used at every execution.

Once we switch to CDC mode, Stambia templates will use the CDC table with the records that were changed since the last execution.

To use a table in CDC mode:

1. Design your mapping as you would normally do. 

In our example we will use our T_CUSTOMER table as a source to load changed data to the backup table T_CUSTOMER_BACKUP

2. Activate CDC mode on the source table, by clicking on the CDC icon :

3. Make sure that you indicate CDC subscriber that you want to use on the load template:

4. Execute the mapping, if you have records that have been changed since you activated CDC on the source table they will be used to update the target table:

Tip: before using the CDC table as a source you might need to load all the records from the source table to the target table so that the two tables are synced from the beginning.

To do that simply create the same mapping without CDC activated on the source table.

This mapping will load all the records from the source to the target table. Once this is done, you can start using the CDC table as source in order to load only the modified records.