confluentinc / confluentinc/confluent-kafka-python
DeserializingConsumer does not return a regular Message when used with AvroDeserializer
- Dominant language
- Python
- Stars
- 509
- Forks
- 964
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 14
Description
Description
===========
The `Message` object returned by `DeserializingConsumer.value()` doesn't appear to match the [signature](https://docs.confluent.io/platform/current/clients/confluent-kafka-python/html/index.html#confluent_kafka.Message.value)- it can return a `dict`, for example, and not only a `str` or `bytes`.
How to reproduce
================
1. Use `AvroDeserializer` to create `DeserializingConsumer`
2. Use `.poll()` method to return message
3. `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:
- [x] 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)
- [ ] Provide broker log excerpts
- [ ] Critical issue
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.