Class ProtobufMessageReader

java.lang.Object
io.confluent.kafka.formatter.SchemaMessageReader<com.google.protobuf.Message>
io.confluent.kafka.formatter.protobuf.ProtobufMessageReader
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.Configurable, org.apache.kafka.tools.api.RecordReader

public class ProtobufMessageReader extends SchemaMessageReader<com.google.protobuf.Message>
Example To use ProtobufMessageReader, first make sure that Zookeeper, Kafka and schema registry server are all started. Second, make sure the jar for ProtobufMessageReader and its dependencies are included in the classpath of kafka-console-producer.sh. Then run the following command.

Send Protobuf record as value. bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic t1 \ --line-reader io.confluent.kafka.formatter.ProtobufMessageReader \ --property schema.registry.url=http://localhost:8081 \ --property value.schema='syntax = "proto3"; message MyRecord { string f1 = 1; }'

In the shell, type in the following. {"f1": "value1"}