You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DeserializingConsumer does not return a regular Message when used with AvroDeserializer #1800
component:schema-registryAny schema registry related isues rather than kafka isolated onespriority:highMaintainer triage tag for indicating high impact or criticality issuessize:smallMaintainer triage tag for indicating change required is particularly smallstatus:help-wantedIssues that would especially appreciate external development or attention
The Message object returned by DeserializingConsumer.value() doesn't appear to match the signature- it can return a dict, for example, and not only a str or bytes.
How to reproduce
Use AvroDeserializer to create DeserializingConsumer
Use .poll() method to return message
Message.value() should contain deserialized dictionary instead of str or bytes
I wonder if the DeserializingConsumer needs a DeserializedMessage, with something like the following:
class DeserializedMessage(Message):
def value(self, payload=None) -> dict:
return super().value(payload)
Checklist
Please provide the following information:
confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()): ('2.3.0', 33751040), ('2.3.0', 33751295)
Apache Kafka broker version:
Client configuration: {...}
Operating system:
Provide client logs (with 'debug': '..' as necessary)
That's exactly what I'm saying. This issue isn't that it doesn't work- it does.
But the Message.value() return from a DeserializingConsumer is a dictionary, right? If so, this doesn't conform to the output in the Message documentation and should be its own class.
I would offer to define such a class (like in the original description above), but the original Message class is not defined in Python.
But the Message.value() return from a DeserializingConsumer is a dictionary, right?
No, it depends on the value serializer that is provided. If no serializer is provided, it is same as what a normal consumer would return i.e. byte/str.
changed the title [-]DeserializingConsumer does not return a regular Message[/-][+]DeserializingConsumer does not return a regular Message when used with AvroDeserializer[/+]on Aug 27, 2024
Okay, I've narrowed the Issue title to indicate that this is true for the AvroDeserializer. It's really just a matter of changing the expected output type to be more inclusive of the possible values.
component:schema-registryAny schema registry related isues rather than kafka isolated onespriority:highMaintainer triage tag for indicating high impact or criticality issuessize:smallMaintainer triage tag for indicating change required is particularly smallstatus:help-wantedIssues that would especially appreciate external development or attention
Activity
InterferencePattern commentedon Aug 19, 2024
Pranav Rathi (@pranavrth) might be the contributor most familar with the DeserializingConsumer
pranavrth commentedon Aug 20, 2024
You need to use
key.deserializerorvalue.deserializerconfig to make it work with deserializer otherwise you will get the message in str or bytes.InterferencePattern commentedon Aug 20, 2024
That's exactly what I'm saying. This issue isn't that it doesn't work- it does.
But the
Message.value()return from aDeserializingConsumeris a dictionary, right? If so, this doesn't conform to the output in theMessagedocumentation and should be its own class.I would offer to define such a class (like in the original description above), but the original Message class is not defined in Python.
pranavrth commentedon Aug 27, 2024
No, it depends on the value serializer that is provided. If no serializer is provided, it is same as what a normal consumer would return i.e. byte/str.
[-]DeserializingConsumer does not return a regular Message[/-][+]DeserializingConsumer does not return a regular Message when used with AvroDeserializer[/+]InterferencePattern commentedon Aug 27, 2024
Okay, I've narrowed the Issue title to indicate that this is true for the
AvroDeserializer. It's really just a matter of changing the expected output type to be more inclusive of the possible values.pranavrth commentedon Aug 29, 2024
I would let Robert Yokota (@rayokota) handle from here whose team deals with Schema Registry.