import pika
import sys

connection = pika.BlockingConnection(pika.ConnectionParameters(host='183.99.87.90'))
channel = connection.channel()

exchange_name = 'topic_logs'
channel.exchange_declare(exchange=exchange_name, exchange_type='topic')

result = channel.queue_declare(queue='')
queue_name = result.method.queue

channel.queue_bind(exchange=exchange_name,
                       queue=queue_name,
                       routing_key="key")

def callback(ch, method, properties, body):
    print(" [x] %s:%s" % (method.routing_key, body))

channel.basic_consume(
        queue=queue_name, on_message_callback=callback)

channel.start_consuming()