diff options
author | Nuno Santos <nsantos@apache.org> | 2008-05-16 01:33:21 +0000 |
---|---|---|
committer | Nuno Santos <nsantos@apache.org> | 2008-05-16 01:33:21 +0000 |
commit | 652be6b00e5b02deca44e291de640762b26a66e3 (patch) | |
tree | 5058e7500a79a983c41df9a70d63c0b11f50af39 | |
parent | 9a3d8ad1695d1b7f2cb42d77c6106245c521566c (diff) | |
download | qpid-python-652be6b00e5b02deca44e291de640762b26a66e3.tar.gz |
QPID-1061: Management heartbeat message from broker -- applied patch supplied by Ted Ross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@656918 13f79535-47bb-0310-9956-ffa450edef68
-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) |