Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass parameters for a specific Schema registry when using Kafka Avro Console Consumer?

Tags:

I am trying to use Confluent kafka-avro-console-consumer, but how to pass parameters for Schema Registry to it?

like image 333
Joe Avatar asked Apr 19 '18 18:04

Joe


People also ask

Is schema registry required for Kafka?

No, Confluent Schema Registry is not required to produce/consume Apache AVRO records in the key or value of a Kafka record.


1 Answers

Just a guess at what you are looking for...

kafka-avro-console-consumer --topic topicX --bootstrap-server kafka:9092 \ 
    --property schema.registry.url="http://schema-registry:8081"

No, you cannot specify a schema version. The ID is consumed directly from the Avro data in the topic. The subject name is mapped to the topic name.

Use --property print.key=true to see the Kafka message key. This is a general property of the regular console consumer.

These are the only extra options in the avro-console-consumer script, meaning other than what's already defined in kafka-consumer-consumer, you can only provide --formatter or --property schema.registry.url, and no other Schema Registry specific parameters (whatever those may be)

for OPTION in "$@"
do
  case $OPTION in
    --formatter)
      DEFAULT_AVRO_FORMATTER=""
      ;;
    --*)
      ;;
    *)
      PROPERTY=$OPTION
      case $PROPERTY in
        schema.registry.url*)
          DEFAULT_SCHEMA_REGISTRY_URL=""
        ;;
      esac
      ;;
    esac
done 
like image 192
OneCricketeer Avatar answered Oct 31 '22 03:10

OneCricketeer