0
0
RabbitMQdevops~10 mins

Publisher confirms 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 enable publisher confirms on the channel.

RabbitMQ
channel.[1]()
Drag options to blanks, or click blank then click option'
Aconfirm_select
Bset_confirm
Cstart_confirm
Denable_confirm
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method that does not exist like 'start_confirm'.
Trying to enable confirms on the connection instead of the channel.
2fill in blank
medium

Complete the code to publish a message and wait for confirmation.

RabbitMQ
channel.basic_publish(exchange='', routing_key='task_queue', body='Hello')
channel.[1]()
Drag options to blanks, or click blank then click option'
Await_for_confirmation
Bwait_for_ack
Cwait_for_confirms
Dwait_for_confirm
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent method like 'wait_for_ack'.
Not waiting for confirms after publishing.
3fill in blank
hard

Fix the error in the code to properly handle publisher confirms.

RabbitMQ
channel.basic_publish(exchange='', routing_key='jobs', body='Run')
if not channel.[1]():
    print('Message not confirmed!')
Drag options to blanks, or click blank then click option'
Await_for_confirms
Bwait_for_confirm
Cwait_for_ack
Dwait_for_confirmation
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method that does not exist or returns nothing.
Assuming the publish method itself returns confirmation.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps message IDs to their confirmation status.

RabbitMQ
confirms = {msg_id: channel.[1](msg_id) for msg_id in message_ids if channel.[2](msg_id)}
Drag options to blanks, or click blank then click option'
Ais_confirmed
Bis_pending
Cis_acknowledged
Dis_rejected
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the methods or using non-existent ones.
Using the same method for both blanks.
5fill in blank
hard

Fill all three blanks to create a dictionary of message IDs and their statuses filtered by confirmed messages.

RabbitMQ
confirmed_msgs = {msg_id: status for msg_id, status in statuses.items() if msg_id [1] confirmed_ids and status [2] 'ack' and not status [3] 'nack'}
Drag options to blanks, or click blank then click option'
Ain
B==
C!=
Dnot in
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not in' instead of 'in' for membership check.
Confusing equality and inequality operators.