18 lines
629 B
Python
18 lines
629 B
Python
import json
|
|
|
|
import pika
|
|
|
|
|
|
def publish_status(task_id, progress, result):
|
|
connection = pika.BlockingConnection(pika.ConnectionParameters('10.1.2.213'))
|
|
channel = connection.channel()
|
|
channel.queue_declare(queue='DesignBatch', durable=True)
|
|
message = {'task_id': task_id, 'progress': progress, "result": result}
|
|
channel.basic_publish(exchange='',
|
|
routing_key='DesignBatch',
|
|
body=json.dumps(message),
|
|
properties=pika.BasicProperties(
|
|
delivery_mode=2,
|
|
))
|
|
connection.close()
|