Create a combined SerDe for Kafka Streams use of Avro
See original GitHub issueKafka Streams uses a combined serialiser/deserializer called a SerDe. The Apicurio Avro support has separate Serializer and Deserializer classes, but no SerDe. I would like to be able to use the Avro support as the default SerDe in a Kafka Streams application so I can write something like this:
Properties props = new Properties();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "ICMJob");
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());
props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, AvroKafkaSerDe.class);
props.put(AbstractKafkaSerDe.REGISTRY_URL_CONFIG_PARAM, "http://localhost:8080");
props.put(AbstractKafkaSerDe.REGISTRY_ID_HANDLER_CONFIG_PARAM, "io.apicurio.registry.utils.serde.strategy.AutoRegisterIdStrategy");
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
props.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 10 * 1000);
StreamsBuilder builder = new StreamsBuilder();
KStream<String, String> stream = builder.stream("mytopic");
stream.print(Printed.toSysOut());
KafkaStreams streams = new KafkaStreams(builder.build(), props);
streams.start();
Without a SerDe, I need to create my own SerDe from an instance of a Serializer and a Deserializer, and I then need to provide that SerDe object where the API permits overriding of the default SerDe. This is cumbersome.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Kafka Streams Data Types and Serialization
Every Kafka Streams application must provide Serdes (Serializer/Deserializer) for the data types of record keys and record values (e.g. java.lang.
Read more >Kafka tutorial #7 - Kafka Streams SerDes and Avro
We will see here how to use a custom SerDe (Serializer / Deserializer) and how to use Avro and the Schema Registry. The...
Read more >Building Serde for Kafka Streams Application - Alternate Stack
The SerdeBuilder can be used to build custom Serdes. Here we are using it for a custom Avro type SensorHeartbeat.
Read more >How to write a KafkaAvro Serde for GenericData.Record
Kafka Streams defines a Serde class that's effectively just a wrapper to combine the Serializer and Deserializer in one class/object since for, e.g.,...
Read more >Kafka streams joins two specific Avro objects - Stack Overflow
EDIT. KStream join: I've simplified joining stream code since I've created joiner class KStream<String, RawPMU_Joined> joinedPMU = pmu214Stream ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, thanks!
Hey @EricWittmann, this one also isn’t required for us for next release, but we think it might not take too long so will get to it if we can. I’ll let you know if/when we are picking it up