如何使用Kombu指定AMQP correlationId?

时间:2013-11-20 02:21:34

标签: python amqp kombu

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

1 个答案:

答案 0 :(得分:1)

如果你grep the source,你可以看到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的名称。