发送JSON数据
通过调用rabbitmq.send_json(channel, user, queue=result)
能够更简单的实现发送JSON数据。
生产者
import json
import rabbitmq
# 建立连接
connection = rabbitmq.get_connection()
# 创建管道
channel = connection.channel()
# 创建队列
queue_name = "user_manager"
result = channel.queue_declare(queue=queue_name)
# 向队列中写入数据
data = [
{
"id"