confluentinc / confluentinc/confluent-kafka-python
Add AggregateSerializer, AggregateDeserializer
- Dominant language
- Python
- Stars
- 509
- Forks
- 965
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 14
Description
Description
===========
I had to write a class like the `AggregateSerializer` below recently. It seems like something that would naturally be in the library given producers can produce to multiple topics and considers can subscribe to multiple topics (each with its own format).
See #838
See #1009
How to implement
================
In `/src/confluent_kafka/serialization/__init__.py`, two classes could be added:
```python
class AggregateSerializer(Serializer):
def __init__(self, serializers: Dict[str, Serializer]):
self.serializers = serializers
def __call__(self, obj, ctx: SerializationContext):
return self.serializers[ctx.topic](obj. ctx)
# And basically the same for AggregateDeserializer
```
And basically the same for `AggregateDeserializer`, plus doc comments per other classes in module.
I can do the legwork to integrate this if it increases the chances of it getting in.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in /src/confluent_kafka/serialization/__init__.py and read the existing Serializer and Deserializer classes, then review the context from #838 and #1009. Done means AggregateSerializer and AggregateDeserializer select the handler for ctx.topic and include documentation consistent with the other classes in the module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100