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 | 6ee707476869bc6c09866b8dd3076c5120b02df7 (patch) | |
| tree | b489d787a88a7fec678c17add92eeb3aca0891db /qpid | |
| parent | 55969a7fa19c4ad182518066afec1b013ec4abd0 (diff) | |
| download | qpid-python-6ee707476869bc6c09866b8dd3076c5120b02df7.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@656918 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
| -rw-r--r-- | qpid/cpp/src/qpid/management/ManagementBroker.cpp | 12 | ||||
| -rw-r--r-- | qpid/python/qpid/management.py | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/management/ManagementBroker.cpp b/qpid/cpp/src/qpid/management/ManagementBroker.cpp index 6466028c00..da6a6fd742 100644 --- a/qpid/cpp/src/qpid/management/ManagementBroker.cpp +++ b/qpid/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/qpid/python/qpid/management.py b/qpid/python/qpid/management.py index 6f68981e4c..2ca433e6d2 100644 --- a/qpid/python/qpid/management.py +++ b/qpid/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) |
