|
| 1 | +# kafka-connect-xml-converter |
| 2 | + |
| 3 | +A Kafka Connect plugin to make it easier to work with XML data in Kafka Connect pipelines. |
| 4 | + |
| 5 | +## Contents |
| 6 | + |
| 7 | +- `com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlConverter` |
| 8 | + - a Kafka Connect converter for converting to/from XML strings |
| 9 | +- `com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlTransformation` |
| 10 | + - a Kafka Connect transformation for converting Kafka Connect records to/from XML strings |
| 11 | +- `com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlMQRecordBuilder` |
| 12 | + - an MQ Source Record builder for parsing MQ messages containing XML strings |
| 13 | + |
| 14 | +## Configuration |
| 15 | + |
| 16 | +Optional configuration that can be set when using the plugin to turn XML strings into Connect records |
| 17 | + |
| 18 | +| **Option** | **Default value** | **Notes** | |
| 19 | +|------------------------|-------------------|------------------------------------------------------------------| |
| 20 | +| `root.element.name` | `root` | The name of the root element in the XML document being parsed. | |
| 21 | +| `xsd.schema.path` | | Location of a schema file to use to parse the XML string. | |
| 22 | +| `xml.doc.flat.enable` | `false` | Set to true if the XML strings contain a single value (e.g. `<root>the message</root>` |) |
| 23 | + |
| 24 | +Optional configuration that can be set when using the plugin to create XML strings from Connect records |
| 25 | + |
| 26 | +| **Option** | **Default value** | **Notes** | |
| 27 | +|------------------------|-------------------|------------------------------------------------------------------| |
| 28 | +| `root.element.name` | `root` | The name to use for the root element of the XML document being created. Only used when no name can be found within the schema of the Connect record. | |
| 29 | + |
| 30 | +## Example uses |
| 31 | + |
| 32 | +Use **`XmlConverter`** with Source Connectors to produce structured Connect records to Kafka topics as XML strings. |
| 33 | + |
| 34 | +``` |
| 35 | +value.converter=com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlConverter |
| 36 | +value.converter.schemas.enable=false |
| 37 | +``` |
| 38 | + |
| 39 | +Use **`XmlConverter`** with Source Connectors to produce Connect records to Kafka topics as XML strings, with an embedded XSD schema. (requires structs) |
| 40 | + |
| 41 | +``` |
| 42 | +value.converter=com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlConverter |
| 43 | +value.converter.schemas.enable=true |
| 44 | +``` |
| 45 | + |
| 46 | +Use **`XmlTransformation`** with Sink Connectors to convert a Connect record containing an XML string into a structured Connect record. |
| 47 | + |
| 48 | +``` |
| 49 | +transforms=xmlconvert |
| 50 | +transforms.xmlconvert.type=com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlTransformation |
| 51 | +transforms.xmlconvert.converter.type=value |
| 52 | +``` |
| 53 | + |
| 54 | +Use **`XmlConverter`** with the MQ Sink Connector to send non-XML Kafka messages to MQ queues as XML strings. |
| 55 | + |
| 56 | +``` |
| 57 | +mq.message.builder=com.ibm.eventstreams.connect.mqsink.builders.ConverterMessageBuilder |
| 58 | +mq.message.builder.value.converter=com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlConverter |
| 59 | +``` |
| 60 | + |
| 61 | +Use **`XmlMQRecordBuilder`** with the MQ Source Connector to convert XML strings from MQ queues into Connect records. |
| 62 | + |
| 63 | +``` |
| 64 | +mq.record.builder=com.ibm.eventstreams.kafkaconnect.plugins.xml.XmlMQRecordBuilder |
| 65 | +mq.record.builder.schemas.enable=true |
| 66 | +mq.record.builder.xsd.schema.path=/location/of/mq-message-schema.xsd |
| 67 | +``` |
0 commit comments