Skip to content

Single message transforms

InfoConnect for Kafka includes custom single message transforms (SMTs) that you add to the source connector configuration with the standard Kafka Connect transforms properties. You can combine them with any other SMT.

Transform Class What it does
DeleteByEventType com.infoviewsystems.kafka.connect.as400.transformer.DeleteByEventType$Value Sends a tombstone record for DELETE events.
ReorderFields com.infoviewsystems.kafka.connect.as400.transformer.ReorderFields Reorders the columns in the payload.

Deleting records by event type

The DeleteByEventType single message transform (SMT) sends a tombstone message (a Kafka record with a non-null key and a null value) for delete events. The SMT checks the event type and sends a tombstone message if the event type is DELETE. For example:

{
  "name": "AS400DataQueueSourceConnector_0",
  "config": {
    "connector.class": "com.infoviewsystems.kafka.connect.as400.core.AS400DataQueueSourceConnector",
    "key.converter": "io.confluent.connect.avro.AvroConverter",
    "value.converter": "io.confluent.connect.avro.AvroConverter",
    "source.kafka.topic": "Test",
    "transforms": "deleteByEventType",
    "transforms.deleteByEventType.type": "com.infoviewsystems.kafka.connect.as400.transformer.DeleteByEventType$Value",
    // Other properties...
  }
}

Reordering columns in the payload

You can reorder the columns in the payload with the custom single message transform (SMT) ReorderFields. The fields.order value is a comma-separated list of column names in the desired order. For example:

{
  "name": "AS400DataQueueSourceConnector_0",
  "config": {
    "connector.class": "com.infoviewsystems.kafka.connect.as400.core.AS400DataQueueSourceConnector",
    "key.converter": "io.confluent.connect.avro.AvroConverter",
    "value.converter": "io.confluent.connect.avro.AvroConverter",
    "source.kafka.topic": "Test",
    "transforms": "ReorderFields",
    "transforms.ReorderFields.type": "com.infoviewsystems.kafka.connect.as400.transformer.ReorderFields",
    "transforms.ReorderFields.fields.order": "field1,field2,field3", // Specify the desired column order here
    // Other properties...
  }
}
  • Replace field1, field2, and field3 with the actual column names in the order you want. The SMT rearranges the columns in the output payload accordingly.
  • If you use Schema Registry, the schema is updated with the new column order, so the topic gets a new schema and version. To avoid breaking existing consumers, set the schema compatibility to NONE in the Schema Registry settings. This allows the schema update without breaking existing consumers. Later you can change the compatibility to BACKWARD or FORWARD as required.