Tulika
Tulika

Reputation: 138

Can i specify only schema id in kafka avro producer

I want to produce avro type message on kafka. Is there a way to use schema id registered ins schema registry instead of specifying schema ?

Upvotes: 1

Views: 1030

Answers (2)

LeYAUable
LeYAUable

Reputation: 1752

On previous versions you couldn't, but in the meanwhile it became possible to do so like this (as mentioned here):

kafka-avro-console-producer \
 --broker-list <broker-list> \
 --topic <topic>  \
 --property schema.registry.url=http://localhost:8081 \
 --property value.schema.id=419

Upvotes: 1

OneCricketeer
OneCricketeer

Reputation: 191854

Not really, no.

But you can download the schema from the registry given the ID, then use that to create a message.

However, if you already have an Avro object, it already has a schema and the Avro serializer will extract it for you and replace it with an ID

Upvotes: 0

Related Questions