0
0
RabbitMQdevops~10 mins

Message acknowledgment 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 acknowledge a message in RabbitMQ using the channel.

RabbitMQ
channel.[1](delivery_tag=method.delivery_tag)
Drag options to blanks, or click blank then click option'
Areject
Bconsume
Cbasic_nack
Dbasic_ack
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reject' instead of 'basic_ack' causes the message to be rejected.
Using 'consume' is for receiving messages, not acknowledging.
2fill in blank
medium

Complete the code to reject a message and requeue it in RabbitMQ.

RabbitMQ
channel.basic_reject(delivery_tag=method.delivery_tag, requeue=[1])
Drag options to blanks, or click blank then click option'
ATrue
BNone
CFalse
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using False will discard the message instead of requeuing.
Using None causes a type error.
3fill in blank
hard

Fix the error in the code to negatively acknowledge multiple messages at once.

RabbitMQ
channel.basic_nack(delivery_tag=method.delivery_tag, multiple=[1])
Drag options to blanks, or click blank then click option'
ATrue
BNone
CFalse
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using False only nacks a single message.
Using None causes a type error.
4fill in blank
hard

Fill both blanks to consume messages with manual acknowledgment enabled.

RabbitMQ
channel.basic_consume(queue='task_queue', on_message_callback=callback, auto_ack=[1], [2]='task_queue')
Drag options to blanks, or click blank then click option'
AFalse
BTrue
Cqueue
Dconsumer_tag
Attempts:
3 left
💡 Hint
Common Mistakes
Setting auto_ack=True disables manual ack.
Using queue instead of consumer_tag for the second blank.
5fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters messages with priority greater than 5 and acknowledges them.

RabbitMQ
acknowledged = {msg_id:priority for msg_id, priority in messages.items() if priority [1] 5 and channel.basic_ack(delivery_tag=[2])}
Drag options to blanks, or click blank then click option'
A:
B>
Cmsg_id
D,
Attempts:
3 left
💡 Hint
Common Mistakes
Using ',' instead of ':' in dictionary comprehension.
Using '<' instead of '>' for filtering priority.
Using wrong variable name for delivery tag.