-
-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package custom serde classes #149
Comments
Hey @jorgheymans , It will need to code on KafkaHQ to handle this case, and will need some precision about the need. How to you see this ?
|
Thanks ! I was thinking this could be done on the level of the consumer because it has standard configuration and properties for this |
Looked into this a bit deeper
This, together with manually copying my required classes for proto serde into kafkahq.jar, makes that i have something working. But it's cumbersome. So if maybe you would agree that in first phase, custom serde should be done via key and value serde properties of the Kafka Consumer i could clean up this part of my patch and propose a PR. |
@tchiotludo any thoughts on this ? |
@jorgheymans If you want to use a custom deserializer if (valueDeserializer == null) {
this.valueDeserializer = config.getConfiguredInstance(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, Deserializer.class);
this.valueDeserializer.configure(config.originals(), false);
} else {
config.ignore(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG);
this.valueDeserializer = valueDeserializer;
} I don't know what is the impact for now, but I have doubt that can work. package org.kafkahq;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.serialization.Deserializer;
import java.util.Map;
public class ValueDeserializer implements Deserializer<byte[]> {
@Override
public void configure(Map configs, boolean isKey) {
}
@Override
public byte[] deserialize(String topic, byte[] data) {
return "{\"a\": 1, \"b\": 1}".getBytes();
}
@Override
public byte[] deserialize(String topic, Headers headers, byte[] data) {
return "{\"a\": 1, \"b\": 1}".getBytes();
}
@Override
public void close() {
}
} Mostly the same than Kafka for that force to return Not really for now. |
Hi, @tchiotludo ! Our team also use Protobuf as message format, and we really like your AKHQ, it will be perfect to have a possibility to pass custom deserializer class (or .proto file as it's done in Kafdrop). Do you plan to add this feature? |
I think this feature is more than welcome, even more since confluent include support for Protobuf on their schema registry. Looking quickly to Kafdrop and .proto files seems to be a better options than a custom jar packaging. Maybe another try catch case here, looping from proto files to try deserialize could do the trick akhq/src/main/java/org/akhq/models/Record.java Lines 100 to 113 in 0a882c1
But to be honest, I not a pro with protobuf at all, never used personally. @jorgheymans what do you think about that (simple proto / try catch deserializer) ? |
We have a fork running inhouse that adds proto serde based on protobin descriptiors. I will check if we're allowed to clean it up and submit a PR. |
Hi, @jorgheymans ! |
Some additional thoughts about this theme. |
Maybe a simply try catch can do the trick, if a custom serde, we try to deserialize with all of them. |
Hi, @tchiotludo ! |
thanks @xakassi 👍 🙏 |
We use protobuf as message format, and have custom serializers for this. Is the only way to include these serializers to build kafkahq from source and include our jar somehow in the gradle build ?
The text was updated successfully, but these errors were encountered: