Please enable JavaScript to view this site.

Navigation: Replicator Engine > Use Case Scenarios

DB2 to Kafka JSON

Scroll

Replicate DB2 changed data (CDC) for the IVP_HR database, EMPLOYEE and DEPARTMENT tables into unique JSON formatted Kafka Topics with default partitioning based on the Db2 table primary keys. All changes to the source tables are Replicated and no filtering is supported. The values for TOPIC and SUBJECT used here are arbitrary but were selected based on the source Table Names, source application and schema source, in this example, the EMPLOYEE and DEPARTMENT Tables, a DB2 "IVP_HR" Database and SQData respectively. Operation of the Replicator will be optimized using one worker thread.

Example

----------------------------------------------------------------------

-- Name: DB2RKAFKA:  Z/OS DB2 Replicate Kafka JSON on Linux

-- Client/Project: client/project

----------------------------------------------------------------------

--       Change Log:

----------------------------------------------------------------------

-- 2020-01-01 INITIAL RELEASE using Kafka Replicator Engine

--

----------------------------------------------------------------------

--       Replicate Source/Target

----------------------------------------------------------------------

REPLICATE

   DB2 cdc://<src_host_name>:<src_sqdaemon_port>/<publisher_name>/<Enging_name>

  TO

  JSON 'kafka:///<prefix>_*_<suffix>/key'

  WITH 1 WORKER

;

----------------------------------------------------------------------

--       Processing Option References

----------------------------------------------------------------------

OPTIONS

   AVRO COMPATIBLE NAMES

  STRIP TRAILING SPACES

;

----------------------------------------------------------------------

--       Source References

----------------------------------------------------------------------

MAPPINGS

   SOURCE 'IVP_HR.EMPLOYEE'

          TOPIC 'EMPLOYEE'

          ALIAS 'EMP'

  ,SOURCE 'IVP_HR.DEPARTMENT'

          TOPIC 'DEPARTMENT'

          ALIAS 'DEPT'

;