Commit 1c2807f5 authored by AVPetukhov's avatar AVPetukhov
Browse files

Delete consumer.py

parent 00523b89
#!/usr/bin/env python
import pika, time, sys
# имя файла, который будем забирать для обработки в 1С
fileName = "d:/from_rabbit.xml"
credentials = pika.PlainCredentials('user_name', 'password')
connection = pika.BlockingConnection(pika.ConnectionParameters('host_name',5672 ,'/', credentials))
channel = connection.channel()
# забираем из очереди
channel.queue_declare(queue='consume_queue', durable=True)
def callback(ch, method, properties, body):
file = open(fileName, "w", encoding="utf-8")
file.write(body.decode("utf-8"))
file.close()
# время ожидания чтобы на стороне 1С успел обработаться файл
time.sleep(body.count(b'.')/100)
ch.basic_ack(delivery_tag = method.delivery_tag)
channel.basic_qos(prefetch_count=1)
channel.basic_consume(callback, queue='consume_queue')
channel.start_consuming()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment