You can download this code by clicking the button below.
This code is now available for download.
This function establishes a connection to a RabbitMQ server and declares a queue. It accepts the host address and port as parameters.
Technology Stack : Pika
Code Type : Function
Code Difficulty : Intermediate
def random_channel_queue_connection(host, port):
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host, port=port))
channel = connection.channel()
channel.queue_declare(queue='random_queue')
return connection, channel