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:
parent
453c707a06
commit
9beefcc4b2
@ -25,7 +25,7 @@ class Message(object):
|
|||||||
self._connection = connection
|
self._connection = connection
|
||||||
self._message_handle = message_handle
|
self._message_handle = message_handle
|
||||||
self.id = None if message_handle is None else \
|
self.id = None if message_handle is None else \
|
||||||
message_handle.headers.get('message_id')
|
message_handle.properties.get('message_id')
|
||||||
try:
|
try:
|
||||||
self.body = None if message_handle is None else \
|
self.body = None if message_handle is None else \
|
||||||
anyjson.loads(message_handle.body)
|
anyjson.loads(message_handle.body)
|
||||||
|
@ -91,14 +91,12 @@ class MqClient(object):
|
|||||||
if not self._connected:
|
if not self._connected:
|
||||||
raise RuntimeError('Not connected to RabbitMQ')
|
raise RuntimeError('Not connected to RabbitMQ')
|
||||||
|
|
||||||
headers = {'message_id': str(message.id)}
|
|
||||||
|
|
||||||
producer = kombu.Producer(self._connection)
|
producer = kombu.Producer(self._connection)
|
||||||
producer.publish(
|
producer.publish(
|
||||||
exchange=str(exchange),
|
exchange=str(exchange),
|
||||||
routing_key=str(key),
|
routing_key=str(key),
|
||||||
body=anyjson.dumps(message.body),
|
body=anyjson.dumps(message.body),
|
||||||
headers=headers
|
message_id=str(message.id)
|
||||||
)
|
)
|
||||||
|
|
||||||
def open(self, queue, prefetch_count=1):
|
def open(self, queue, prefetch_count=1):
|
||||||
|
Loading…
Reference in New Issue
Block a user