mockafka-py
mockafka-py copied to clipboard
Message timestamp interface doesn't match confluent_kafka
Describe the bug
The Message class in confluent_kafka returns a tuple of timestamp type and the timestamp itself, I infer the type is tuple[int, int] but the corresponding class in mockafka returns int | None.
To Reproduce Code designed for parsing the timestamp from a confluent_kafka Message will fail:
consumer = FakeConsumer()
consumer.subscribe(["my_topic"])
msg = consumer.poll()
timestamp_type, timestamp = msg.timestamp() # Results in TypeError: cannot unpack non-iterable int/NoneType object
Expected behavior I hope that compatibility with confluent_kafka can be maintained!
mockafka-py==0.1.55 confluent-kafka==2.3.0 Python 3.11.8
@MrkGrgsn Thanks for raising this issue,
I will fix it soon.
Take a look https://github.com/alm0ra/mockafka-py/pull/146
now it does supports and its fully compatible with confluent_kafka library timestamp method