Example #1
0
def pushtomq(channel, message):
    env = tools.fetchenv()

    channel.basic_publish(exchange='',
                          routing_key=str(env['CRAWLER_AMQP_ROUTING_KEY']),
                          body=message,
                          properties=pika.BasicProperties(delivery_mode = 2))
Example #2
0
def consumemq(channel, callback):
    env = tools.fetchenv()

    channel.basic_consume(callback, queue=str(env['CRAWLER_AMQP_ROUTING_KEY'])) 
    channel.start_consuming()