Fix content type for qpid notifier.

Fix bug 980872.

This patch fixes a regression I introduced in
2d36facf14.  In that patch, I adjusted the
content_type for messages sent with the qpid notifier to be
'application/json' to match a change that went into the kombu notifier.
Unfortunately, it's wrong.

I assumed based on the kombu change that notifications were being json
encoded before being passed into the notification driver.  That's not
the case.  The message is a dict.  So, just revert the change to set the
content_type and let Qpid encode the notification as 'amqp/map'.

(cherry picked from commit 5bed23cbc9)

Change-Id: I8ba039612d9603377028ba72cb80ae89d675c741
This commit is contained in:
Russell Bryant 2012-04-24 12:24:39 -04:00
parent 98913da774
commit 5838b63903
2 changed files with 4 additions and 7 deletions

View File

@ -135,16 +135,13 @@ class QpidStrategy(strategy.Strategy):
return self.session.sender(address)
def warn(self, msg):
qpid_msg = qpid.messaging.Message(content=msg,
content_type='application/json')
qpid_msg = qpid.messaging.Message(content=msg)
self.sender_warn.send(qpid_msg)
def info(self, msg):
qpid_msg = qpid.messaging.Message(content=msg,
content_type='application/json')
qpid_msg = qpid.messaging.Message(content=msg)
self.sender_info.send(qpid_msg)
def error(self, msg):
qpid_msg = qpid.messaging.Message(content=msg,
content_type='application/json')
qpid_msg = qpid.messaging.Message(content=msg)
self.sender_error.send(qpid_msg)

View File

@ -316,7 +316,7 @@ class TestQpidNotifier(unittest.TestCase):
super(TestQpidNotifier, self).tearDown()
def _test_notify(self, priority):
test_msg = json.dumps({'a': 'b'})
test_msg = {'a': 'b'}
self.mock_connection = self.mocker.CreateMock(self.orig_connection)
self.mock_session = self.mocker.CreateMock(self.orig_session)