0
0
RabbitMQdevops~10 mins

Why message queues decouple services in RabbitMQ - Test Your Understanding

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

Complete the code to declare a queue named 'task_queue' in RabbitMQ.

RabbitMQ
channel.queue_declare(queue='[1]')
Drag options to blanks, or click blank then click option'
Aqueue1
Bjobs
Cmessages
Dtask_queue
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic or wrong queue name like 'jobs' or 'messages'.
2fill in blank
medium

Complete the code to publish a message 'Hello' to the 'task_queue'.

RabbitMQ
channel.basic_publish(exchange='', routing_key='task_queue', body='[1]')
Drag options to blanks, or click blank then click option'
AHello
BHi
CMessage
DTest
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different message text than 'Hello'.
3fill in blank
hard

Fix the error in the code to consume messages from 'task_queue'.

RabbitMQ
channel.basic_consume(queue='task_queue', on_message_callback=[1], auto_ack=True)
Drag options to blanks, or click blank then click option'
Ahandle_message
Bprocess_message
Ccallback
Dconsume
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic or undefined function name.
4fill in blank
hard

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

RabbitMQ
filtered = {msg: priority[1] for msg, priority in messages.items() if priority [2] 5}
Drag options to blanks, or click blank then click option'
A**2
B>
C*2
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using exponentiation instead of multiplication.
Using less than instead of greater than.
5fill in blank
hard

Fill all three blanks to create a dictionary of uppercase message keys with their priorities filtered by priority > 3.

RabbitMQ
result = [1]: [2] for [3], priority in messages.items() if priority > 3}
Drag options to blanks, or click blank then click option'
Amsg.upper()
Bpriority
Cmsg
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names or not converting keys to uppercase.