Send message_id as property

message_id field should be sent as message property, not as
field in message headers

Change-Id: I2eaa705673408b4cdacf8571072312ddbf8efd69
Closes-Bug: #1322078
This commit is contained in:
Serg Melikyan 2014-05-23 13:24:44 +04:00
parent 453c707a06
commit 9beefcc4b2
2 changed files with 2 additions and 4 deletions

View File

@ -25,7 +25,7 @@ class Message(object):
self._connection = connection
self._message_handle = message_handle
self.id = None if message_handle is None else \
message_handle.headers.get('message_id')
message_handle.properties.get('message_id')
try:
self.body = None if message_handle is None else \
anyjson.loads(message_handle.body)

View File

@ -91,14 +91,12 @@ class MqClient(object):
if not self._connected:
raise RuntimeError('Not connected to RabbitMQ')
headers = {'message_id': str(message.id)}
producer = kombu.Producer(self._connection)
producer.publish(
exchange=str(exchange),
routing_key=str(key),
body=anyjson.dumps(message.body),
headers=headers
message_id=str(message.id)
)
def open(self, queue, prefetch_count=1):