diff options
-rw-r--r-- | cpp/src/qpid/management/ManagementBroker.cpp | 12 | ||||
-rw-r--r-- | python/qpid/management.py | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/cpp/src/qpid/management/ManagementBroker.cpp b/cpp/src/qpid/management/ManagementBroker.cpp index 6466028c00..da6a6fd742 100644 --- a/cpp/src/qpid/management/ManagementBroker.cpp +++ b/cpp/src/qpid/management/ManagementBroker.cpp @@ -25,6 +25,7 @@ #include <qpid/broker/Message.h> #include <qpid/broker/MessageDelivery.h> #include "qpid/framing/MessageTransferBody.h" +#include "qpid/sys/Time.h" #include <list> #include <iostream> #include <fstream> @@ -246,6 +247,17 @@ void ManagementBroker::PeriodicProcessing (void) string routingKey; std::list<uint64_t> deleteList; + { + Buffer msgBuffer(msgChars, BUFSIZE); + EncodeHeader(msgBuffer, 'h'); + msgBuffer.putLongLong(uint64_t(Duration(now()))); + + contentSize = BUFSIZE - msgBuffer.available (); + msgBuffer.reset (); + routingKey = "mgmt." + uuid.str() + ".heartbeat"; + SendBuffer (msgBuffer, contentSize, mExchange, routingKey); + } + if (managementObjects.empty ()) return; diff --git a/python/qpid/management.py b/python/qpid/management.py index 6f68981e4c..2ca433e6d2 100644 --- a/python/qpid/management.py +++ b/python/qpid/management.py @@ -170,6 +170,7 @@ class managementClient: CTRL_BROKER_INFO = 1 CTRL_SCHEMA_LOADED = 2 CTRL_USER = 3 + CTRL_HEARTBEAT = 4 SYNC_TIME = 10.0 @@ -304,6 +305,8 @@ class managementClient: self.handlePackageInd (ch, codec) elif hdr[0] == 'q': self.handleClassInd (ch, codec) + elif hdr[0] == 'h': + self.handleHeartbeat (ch, codec) else: self.parse (ch, codec, hdr[0], hdr[1]) ch.accept(msg) @@ -549,6 +552,11 @@ class managementClient: smsg = ch.message(sendCodec.encoded) ch.send ("qpid.management", smsg) + def handleHeartbeat (self, ch, codec): + timestamp = codec.read_uint64() + if self.ctrlCb != None: + self.ctrlCb (ch.context, self.CTRL_HEARTBEAT, timestamp) + def parseSchema (self, ch, codec): """ Parse a received schema-description message. """ self.decOutstanding (ch) |