rabbitmq 服务器没有收到来自 python 客户端的消息
rabbitmq server does not receive messages from a python client
我正在尝试向 rabbitmq 发布消息。这在使用相同代码的生产环境环境中工作,所以我怀疑这是一个 配置问题。
rbqueue = RabbitMQClientQueue('cn-dip-v3', host = rabbitmq_config['host'], username = rabbitmq_config['user'], password = rabbitmq_config['password'])
channel = rbqueue.connection.channel()
args = {"x-max-priority": 10}
channel.queue_declare(queue='cn-dip-v3', durable=True, arguments=args)
result = channel.queue_declare(exclusive=True)
callback_queue = result.method.queue
msgBody = json.dumps({"ohad":123})
# may happen that sendResponseToDal is True but there is no sendResponseToDal method on server side
data = {"body":msgBody,"queue_response" : False}
if responseHandler:
data["queue_response"] = True
corrID = str(uuid.uuid4())
>>> channel.basic_publish(exchange='',routing_key='cn-dip-v3',properties=pika.BasicProperties(priority = 10, reply_to = callback_queue,correlation_id = corrID,),body=json.dumps(data))
>>>
queue_declare
有效。如果我删除它并且 运行 队列被定义在同一行。我在管理面板中看到它,奇怪的是,它在端口 55672 而不是 15672。
此外,每次我 运行 channel.basic_publish
之后,我都会看到另一个回调队列被添加到 rabbitmq 管理中的队列部分。
所缺少的只是到达那里的消息。
你对端口的评论让我怀疑你有不同版本的消息代理在运行。 RabbitMQ 3.0之前版本的端口是55672,3.0和之后的版本有很大区别。
我正在尝试向 rabbitmq 发布消息。这在使用相同代码的生产环境环境中工作,所以我怀疑这是一个 配置问题。
rbqueue = RabbitMQClientQueue('cn-dip-v3', host = rabbitmq_config['host'], username = rabbitmq_config['user'], password = rabbitmq_config['password'])
channel = rbqueue.connection.channel()
args = {"x-max-priority": 10}
channel.queue_declare(queue='cn-dip-v3', durable=True, arguments=args)
result = channel.queue_declare(exclusive=True)
callback_queue = result.method.queue
msgBody = json.dumps({"ohad":123})
# may happen that sendResponseToDal is True but there is no sendResponseToDal method on server side
data = {"body":msgBody,"queue_response" : False}
if responseHandler:
data["queue_response"] = True
corrID = str(uuid.uuid4())
>>> channel.basic_publish(exchange='',routing_key='cn-dip-v3',properties=pika.BasicProperties(priority = 10, reply_to = callback_queue,correlation_id = corrID,),body=json.dumps(data))
>>>
queue_declare
有效。如果我删除它并且 运行 队列被定义在同一行。我在管理面板中看到它,奇怪的是,它在端口 55672 而不是 15672。
此外,每次我 运行 channel.basic_publish
之后,我都会看到另一个回调队列被添加到 rabbitmq 管理中的队列部分。
所缺少的只是到达那里的消息。
你对端口的评论让我怀疑你有不同版本的消息代理在运行。 RabbitMQ 3.0之前版本的端口是55672,3.0和之后的版本有很大区别。