27 lines
847 B
Python
27 lines
847 B
Python
import json
|
|
|
|
import pika
|
|
|
|
from mini_queue.utils.config import CONFIG
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
credentials = pika.PlainCredentials(CONFIG.rabbitmq.user, CONFIG.rabbitmq.password)
|
|
queue = CONFIG.rabbitmq.queues.input
|
|
parameters = pika.ConnectionParameters(
|
|
host=CONFIG.rabbitmq.host,
|
|
port=CONFIG.rabbitmq.port,
|
|
heartbeat=CONFIG.rabbitmq.heartbeat,
|
|
credentials=credentials,
|
|
)
|
|
body = json.dumps({"fileId": "234", "dossierId": "3403"})
|
|
connection = pika.BlockingConnection(parameters)
|
|
channel = connection.channel()
|
|
channel.queue_declare(queue=queue, durable=True)
|
|
channel.basic_publish("", queue, body)
|
|
print(f" [x] Sent {body} on {queue}")
|
|
|
|
for method_frame, _, body in channel.consume(queue=CONFIG.rabbitmq.queues.output):
|
|
print(json.loads(body))
|
|
break |