Overriding the default settings
A transformation can be defined that overrides the topic, partition and ordering key settings defined in the General tab.
Before you can define such a transformation, you first need to add a source endpoint to the task and select the tables you want to replicate.
To define a transformation:
- Open the task you defined.
- If you are defining a transformation for a single table, select one of the source tables. Otherwise, skip to Step 3.
-
Define a transformation that adds one of the following columns:
Information noteThe columns listed below (prefixed with a $) instruct Replicate to route the message to the desired topic and/or partition, and will not be included in the actual message itself.
- $topic - To write messages to a specific topic.
- $partition - To write messages to a specific partition.
- $key - To create a custom ordering key.
For information on creating a transformation for a single table, see Defining transformations for a single table/view.
For information on creating a global transformation rule, see Starting the Global Transformation Rules wizard.
- Define an expression for the new column that returns the following values:
- For a $topic column, the expression should return the topic name.
- For a $partition column, the expression should return the partition number. Note that an error will be returned during runtime if the partition number does not exist.
- For a $key column, the expression should return the ordering key contents. Note that the expression must return a non-empty value.
For information on creating expressions, see Using the Expression Builder.