prefetch_count dont working with pika consume method

198 views
Skip to first unread message

Štěpán Fohl

unread,
Nov 9, 2022, 11:26:48 AM11/9/22
to rabbitmq-users
Hello,
i have problem while using consume method (not basic_consume) on blockingConnection with prefetch_count.

Looks like channel.basic_qos(prefetch_count=X) dont work and consume (it returns generator) have too much messages in queue so its ending with "PRECONDITION_FAILED - consumer ack timed out on channel" after 30minutes (timeout by Rabbit server).

Googled and read alot of documentation and examples also trying to get something from pika sources but without success. There is alot about basic_consume() but not much about consume(). Using consume() because i can set inactivity timeout for blocking to take care about other stuff around.

Maybe prefetch dont work at all while using consume (consumer generator), iterrating via for loop like:

for method, properties, body in Channel.consume(queue, auto_ack=False, inactivity_timeout=30)

Using pika 1.2.0

Thank you for any info

Luke Bakken

unread,
Nov 9, 2022, 11:31:20 AM11/9/22
to rabbitmq-users
Hello,

Rather than provide one line of code, it would be most helpful to for you to provide a complete, runnable Python program that reproduces this issue.

If you see the "consumer ack timed out" message it means your application is not acknowledging messages within 30 minutes.

You have a bug in your application. If you share all of your code, I could probably figure out the issue very quickly.

Thanks,
Luke

Štěpán Fohl

unread,
Nov 9, 2022, 12:05:30 PM11/9/22
to rabbitmq-users
hello,
yes i know exactly what that error means, because processing single message took like 1sec (that means its slow) i figured out i have to play with prefetch_count, my question (my bad i should write it simple) is/was:

do prefetch_count while using consume(), not basic_consume() in pika ?

sorry but i cant provide complete runnable program because its very big and complex, this is one piece (module) of that complex system which for looping on consume, process one message in about 1sec and then basic_ack(method.delivery_tag)
 
UPDATE:
its solved, my problem was i had no information about prefetch_count is working because consumer generator dont exit that loop (as i expected) after proces its prefetched messages, i figured out all is working fine after tryed use get_waiting_message_count() method

thanx and sorry - my bad

Dne středa 9. listopadu 2022 v 17:31:20 UTC+1 uživatel luker...@gmail.com napsal:
Reply all
Reply to author
Forward
0 new messages