0
0
RabbitMQdevops~10 mins

Connections and channels 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 open a new connection to RabbitMQ server.

RabbitMQ
connection = pika.BlockingConnection(pika.ConnectionParameters('[1]'))
Drag options to blanks, or click blank then click option'
Aqueue
Bchannel
Clocalhost
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'channel' or 'queue' instead of server address.
2fill in blank
medium

Complete the code to create a new channel from the connection.

RabbitMQ
channel = connection.[1]()
Drag options to blanks, or click blank then click option'
Achannel
Bconnect
Copen_channel
Dchannel()
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connect' or 'open_channel' which are not valid methods.
3fill in blank
hard

Fix the error in the code to properly close the connection.

RabbitMQ
connection.[1]()
Drag options to blanks, or click blank then click option'
Aclose
Bdisconnect
Cclose_connection
Dshutdown
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'disconnect' or 'shutdown' which are not valid methods.
4fill in blank
hard

Fill both blanks to declare a queue and publish a message to it.

RabbitMQ
channel.queue_declare(queue='[1]')
channel.basic_publish(exchange='', routing_key='[2]', body='Hello World!')
Drag options to blanks, or click blank then click option'
Atask_queue
Bhello
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using different queue names in declaration and publishing.
5fill in blank
hard

Fill all three blanks to open a connection, create a channel, and close the connection.

RabbitMQ
connection = pika.BlockingConnection(pika.ConnectionParameters('[1]'))
channel = connection.[2]()
connection.[3]()
Drag options to blanks, or click blank then click option'
Alocalhost
Bchannel
Cclose
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connect' instead of 'channel' or wrong method to close connection.