Configuring Schema Mapping in aieventconfig.txt for Avro serialization

You must configure the schemamapping section in the aiventconfig.txt file to specify the topics, partitions, and schema file for each partition. Configuring partitions is optional, you can specify the schema file directly for the topic using the default parameter.

Sample schemamapping section in aieventconfig.txt

schemamapping: [
            {
                "topic1":
 {
                    "1": "topic1_1.txt",
                    "2": "topic1_2.txt"
                }
            },
            {
                "topic2": 
{
                    "default": "topic2_schema.txt"
               }
            }
        ]

In the example above:

  1. Messages for topic1 are produced to Kafka partitions 1 and 2.
  2. Messages for topic1 partition1 are serialized using the topic1_1.txt schema file.
  3. Messages for topic1 partition2 are serialized using the topic1_2.txt schema file.
  4. Messages for topic2 are produced to the Kafka topic using the topic2_schema.txt schema file.
Note:
  • Ensure that the configuration of the schemamapping section is consistent with the topic and partition definitions in the eventpayloadconfig.txt file.
  • When the default schema is configured for a topic, you must not add partitions for the topic. For example, you cannot configure as follows:
    "schemamapping": [
                {
                    "topic1": {
                        "1": "topic1_1.txt",
                        "default": "topic1_2.txt"
                    }
                }
            ]
    
  • Avro schema conversion for topic’s messages will not occur if the topic is not included in the schemamapping section.