#!/bin/env python import amqplib.client_0_8 as amqp # Connect connection = amqp.Connection( host = "localhost:5672", userid = "guest", password = "guest", virtual_host = "/", insist = False ) # Create our channel channel = connection.channel() """ We've already declared our queue, exchange and binding in our consumer so just send the messages """ for i in range(0, 10): message = amqp.Message("Test message %i!" % i) message.properties["delivery_mode"] = 2 channel.basic_publish( message, exchange = "test", routing_key = "test.messages")