Skip to content

    Key Schema Mapping Plugin

    The key-schema-mapping plugin is used to map the schema IDs of the keys in the data. This is useful when migrating data from one environment to another, where the schema IDs of the keys are different in the two.

    For each message that is processed by the plugin, the plugin will map the schema id of the key to a new schema ID. It does this by looking up the schema ID in the mapping that is defined in the plugin specification, and replacing the schema ID of the key with the new schema ID (by replacing the magic byte.

    Defining the mapping

    The mapping is defined in the mapping field of the plugin specification. The mapping is an object that contains the source schema IDs as keys and the target schema IDs as values.

    plugins:
    - name: "key-schema-mapping"
    spec:
    mapping:
    10001: 20001
    10002: 20002

    In this example,

    • the plugin will map the schema with id 10001 to the schema with id 20001.
    • the plugin will map the schema with id 10002 to the schema with id 20002.

    What if no schema mapping is found for a schema ID?

    In case the plugin encounters a schema ID that is not found in the schema mapping, it will skip the schema mapping for that schema ID and restore the data as is.