confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

How to produce the undelivered messages after timeout of producer.flush(1.0)

Open shuvohishab opened this issue 1 year ago • 3 comments

Description

I'm producing some messages in our Kafka server, but getting acknowledgement of message delivery(produccer.flush()) is taking a huge time. That's why I added timeout of 1 second. But I noticed that there are some messages left to deliver from our end. How to produce such undelivered messages? Any ways?

How to reproduce

producer.poll(0.0) producer.produce( topic=topic, key=str(uuid4()), value=output_msg, on_delivery=delivery_report_wrapper, headers=logger_extra, ) pending_messages = producer.flush(1.0) logger.info(f"number of messages still in queue: {pending_messages}")

Checklist

Please provide the following information:

  • [ ] confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()): confluent_kafka==1.9.0
  • [ ] Apache Kafka broker version:
  • [ ] Client configuration: {...}
  • [ ] Operating system: Linux
  • [ ] Provide client logs (with 'debug': '..' as necessary): number of messages still in queue: 1
  • [ ] Provide broker log excerpts
  • [ ] Critical issue

shuvohishab avatar Jul 05 '24 04:07 shuvohishab

I see that you are using an old version of the client. Can you use the latest one?

Can you also provide the debug logs for the same by setting debug: broker,topic,msg?

pranavrth avatar Jul 05 '24 05:07 pranavrth

Hi @pranavrth, thanks for your quick response. I'll come back with your answer. But can I know, do I have to update my python protobuf for this? Or, just updating confluent-kafka will work?

shuvohishab avatar Jul 05 '24 05:07 shuvohishab

I think just confluent_kafka should work.

pranavrth avatar Jul 05 '24 05:07 pranavrth

Closing as no new information on trying new kafka version was provided

MSeal avatar Jul 23 '25 22:07 MSeal