0
0
RabbitMQdevops~10 mins

Consumer prefetch optimization in RabbitMQ - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the prefetch count to 10 for a RabbitMQ channel.

RabbitMQ
channel.basic_qos(prefetch_count=[1])
Drag options to blanks, or click blank then click option'
A0
B20
C10
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting prefetch_count to 0 disables prefetching, which may overload the consumer.
2fill in blank
medium

Complete the code to enable manual message acknowledgments in the consumer.

RabbitMQ
channel.basic_consume(queue='task_queue', on_message_callback=callback, auto_ack=[1])
Drag options to blanks, or click blank then click option'
ATrue
BFalse
CNone
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using True disables manual acknowledgments and prefetch control.
3fill in blank
hard

Fix the error in setting prefetch count to limit unacknowledged messages to 5.

RabbitMQ
channel.basic_qos(prefetch_count=[1])
Drag options to blanks, or click blank then click option'
A5
BNone
C-5
D'5'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of an integer causes a type error.
4fill in blank
hard

Fill both blanks to set prefetch count to 20 and disable global prefetch.

RabbitMQ
channel.basic_qos(prefetch_count=[1], global=[2])
Drag options to blanks, or click blank then click option'
A20
BTrue
CFalse
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Setting global to True applies prefetch count globally, not per consumer.
5fill in blank
hard

Fill all three blanks to create a consumer with prefetch count 15, manual ack, and queue named 'jobs'.

RabbitMQ
channel.basic_qos(prefetch_count=[1])
channel.basic_consume(queue=[2], on_message_callback=callback, auto_ack=[3])
Drag options to blanks, or click blank then click option'
A15
B'jobs'
CFalse
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using True for auto_ack disables manual acknowledgments.