2

Trying to consume kafka Avro messages from console consumer and not exactly sure how to deserialize the messages.

sh /usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --bootstrap-server localhost:6667 --topic test --consumer.config /home/user/kafka.consumer.properties --from-beginning --value-deserializer ByteArrayDeserializer

The Avro Schema in Schema Registry for the test topic is:

{
 "type": "record",
 "namespace": "test",
 "name": "TestRecord",
 "fields": [
  {
   "name": "Name",
   "type": "string",
   "default": "null"
  },
  {
   "name": "Age",
   "type": "int",
   "default": -1
  }
 ]
}

Using HDP 3.1 version and Kafka-clients-2.0.0.3.1.0.0-78

Could someone help me what would be the Deserializer required to read Avro messages from console.

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
William R
  • 739
  • 2
  • 13
  • 34

1 Answers1

3

Use kafka-avro-console-consumer

e.g.

sh /usr/hdp/current/kafka-broker/bin/kafka-avro-console-consumer.sh \
--bootstrap-server localhost:6667 \
--topic test \
--from-beginning \
--property schema.registry.url=http://localhost:8081
Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92