question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create a combined SerDe for Kafka Streams use of Avro

See original GitHub issue

Kafka 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ajborleycommented, Sep 17, 2020

Yes, thanks!

1reaction
katheriscommented, Aug 28, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found