Fix Qpid when sending long messages (from oslo)

This is commit 4f97479ad in oslo-incubator

Qpid has a limitation where it cannot serialize a dict containing a
string greater than 65535 characters. This change alters the Qpid
implementation to JSON encode the dict before sending it, but only if
Qpid would fail to serialize it. This maintains as much backward
compatibility as possible, though long messages will still fail if they
are sent to an older receiver.

The first part of this fix was ported to Grizzly in Ib52e9458a to allow
receiving messages from Havana using the new format. Even though this
change will modify the message format, it will only do it when messages
are longer than 65K which would be broken anyway and could cause serious
bugs like the one linked below.

Fixes bug 1215091

Change-Id: I505b648c3d0e1176ec7a3fc7d1646fa5a5232261
Merge "Fix Qpid when sending long messages (from oslo)" into cells_grizzly