Complete the code to set the prefetch count to 10 for a RabbitMQ channel.
channel.basic_qos(prefetch_count=[1])Setting prefetch_count to 10 limits the consumer to receive only 10 unacknowledged messages at a time, optimizing resource usage.
Complete the code to enable manual message acknowledgments in the consumer.
channel.basic_consume(queue='task_queue', on_message_callback=callback, auto_ack=[1])
Setting auto_ack to False means the consumer must manually acknowledge messages, allowing better control and prefetch optimization.
Fix the error in setting prefetch count to limit unacknowledged messages to 5.
channel.basic_qos(prefetch_count=[1])The prefetch_count must be an integer. Using a string or negative number causes errors.
Fill both blanks to set prefetch count to 20 and disable global prefetch.
channel.basic_qos(prefetch_count=[1], global=[2])
Setting prefetch_count to 20 limits unacknowledged messages to 20 per consumer. Setting global to False applies this limit per consumer, not globally.
Fill all three blanks to create a consumer with prefetch count 15, manual ack, and queue named 'jobs'.
channel.basic_qos(prefetch_count=[1]) channel.basic_consume(queue=[2], on_message_callback=callback, auto_ack=[3])
This setup limits unacknowledged messages to 15, consumes from the 'jobs' queue, and requires manual acknowledgments for better control.