The SETURL function can be used to specify the full CDC:///url when a combination of literal text prefixes, suffixes and source descriptions aliases will not meet requirements to be used when writing to a Kafka Target. For more information, see Kafka Datastores.
Category
Specialized
Syntax
SETURL(<target_datastore>, 'kafka:///<url_string>[/<partition> |/key |/root_key |/]')
Parameter and Description
Parameter | Description |
---|---|
kafka:///<url_string>[/<partition> |/key |/root_key |/]' | The url_string may consist of any combination of literals, variables, source alias references and source data concatenated to create a Kafka topic url. While the trailing /<partition> |/key |/root_key |/ is optional one must be specified as a placeholder if the SETURLKEY function is also used and a single / is recommended. |
Example
Construct Kafka url's using more descriptive topics.
DESCRIPTION DB2SQL ./DB2DDL/EMP.ddl AS EMP
DESCRIPTION DB2SQL ./DB2DDL/DEPT.ddl AS DEPT
KEY IS DEPT_NO;
DATASTORE kafka:///key
...
Used with the following logic in the Apply Engine script:
CREATE PROC P_EMP AS SELECT
{
SETURL(TARGET, 'kafka:///cdc_EMPLOYEE_db2/key')
REPLICATE(TARGET, EMP)
}
CREATE PROC P_DEPT AS SELECT
{
SETURL(TARGET, 'kafka:///cdc_DEPARTMENT_db2/key')
REPLICATE(TARGET, DEPT)
}