mockafka-py icon indicating copy to clipboard operation
mockafka-py copied to clipboard

Message timestamp interface doesn't match confluent_kafka

Open MrkGrgsn opened this issue 1 year ago • 2 comments

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 avatar Apr 24 '24 06:04 MrkGrgsn

@MrkGrgsn Thanks for raising this issue,

I will fix it soon.

alm0ra avatar Apr 27 '24 21:04 alm0ra

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

massooti avatar Aug 15 '24 16:08 massooti