documentation建议按照AMQP规范,将额外的AMQP属性作为关键字参数传递给publish,但是correlationId="foo"似乎没有达到预期的效果。

最佳答案

如果您对源代码进行grep,则可以看到Kombu itself fills out a correlation ID calling publish, in kombu.common.send_reply的位置:

producer.publish(
    msg, exchange=exchange,
    retry=retry, retry_policy=retry_policy,
    **dict({'routing_key': req.properties['reply_to'],
            'correlation_id': req.properties.get('correlation_id'),
            'serializer': serializers.type_to_name[req.content_type],
            'content_encoding': req.content_encoding}, **props)
)


correlation_id是所使用的kwarg的名称。

关于python - 如何为Kombu指定AMQP关联ID?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20086106/

10-13 09:06