Help with protobuf decoding by schema registry #1680
-
Hello, i have problem with setting up proto schemas for topic.
Please, explain by steps how to set it up properly |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 21 replies
-
Hi, could you please share an example schema and a message to reproduce this? Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hello @mihelanjelo! Usually kafka libraries hide first 5 bytes generating for end user. In your case you likely skip 5-bytes prefix, so kafka deserializer can't detect schema for parsing. In such scenario kafka-ui falls back to string deserializing. See python AvroSerializer usage here: https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/avro_producer.py |
Beta Was this translation helpful? Give feedback.
-
@mihelanjelo You can read and decode protobuf messages in your code because you know schema of you messages, but kafka-ui does not. To solve such cases schema registry exists. Schema registry is needed to mark every message you write to kafka with schema id used for serialization. Later when reading messages (by any other consumer) corresponding schema will be extracted from registry and used for deserialzation. Please see concepts described here -> https://docs.confluent.io/platform/current/schema-registry/index.html. Sorry for pointing you to wrong producing-> here is an example of protobuf producer schemaregistry usage https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/protobuf_producer.py#L76. From my understanding currently you just serialize your message using protobuf and write to kafka as raw bytes - in that case consumer have no ability to get schema, even it is created in schema-registry. If you want to write raw bytes messages, serialized via protobuf (without using schemaregistry) you can pass kafka-ui topic->protofile mapping. This mapping will be used for messages deserialization by kafka-ui and you will be able to see messages content in ui. (this is not documented, and only values deserialisation supported for such topics). Let me know I will write how to pass such config. |
Beta Was this translation helpful? Give feedback.
-
Latest docs on serialization |
Beta Was this translation helpful? Give feedback.
Latest docs on serialization