xml到avro的转换

xfb7svmp  于 2021-06-04  发布在  Kafka
关注(0)|答案(0)|浏览(330)

您好,我正在使用ibmmqsource连接器从IBMMQ中提取数据,数据以xml文件格式驻留在IBMMQ中。当我使用ibmmqsource连接器并尝试将同一个xml文件转换为avro时 enter code here 使用值转换器作为avroconverter,它将整个xml文件作为单个字符串值放入文本键中。有谁能帮我把这个换成avro吗。需求是使用schema注册表将schama和消息存储为avro。输出应该是带有键值对的avro,当它以值的形式发送整个xml文件时。
输入

<?xml version="1.0" encoding="ISO-8859-1"?>  
    <note>  
      <to>Tove</to>  
      <from>Jani</from>  
      <heading>Reminder</heading>  
      <body>Don't forget me this weekend!</body>  
    </note>

输出

{"text":<?xml version="1.0" encoding="ISO-8859-1"?> <note>   <to>Tove</to>  <from>Jani</from> <heading>Reminder</heading>  <body>Don't forget me this weekend!</body>  </note> }

预期产量

{"note":"[{"to":"Tove"},{"from":"Jani"},{"heading":"Reminder"},{"body":"Don't forget me this weekend!"}]"}

谢谢,期待你们的帮助。
ibmmqsource连接器配置

{
      "name": "Mqconnector",
      "config": {
        "connector.class": "io.confluent.connect.ibm.mq.IbmMQSourceConnector",
        "kafka.topic":"KafkaTopicName",
        "mq.hostname":"localhost",
        "mq.port":"port",
        "mq.transport.type":"client",
        "mq.queue.manager":"qma",
        "mq.channel":"SYSTEM.DEF.SVRCONN",
        "jms.destination.name":"testing",
        "jms.destination.type":"queue",
        "confluent.license":"",
        "confluent.topic.bootstrap.servers":"localhost:9092"
        "key.converter":"io.confluent.connect.avro.AvroConverter",
        "key.converter.schema.registry.url":"http://localhost:8081",
        "value.converter":"io.confluent.connect.avro.AvroConverter",
        "value.converter.schema.registry.url":"http://localhost:8081"
        "transforms": "ExtractField",
        "transforms.ExtractField.type":"org.apache.kafka.connect.transforms.ExtractField$Value",
        "transforms.ExtractField.field":"text"

      }
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题