summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2010-03-02 21:21:13 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2010-03-02 21:21:13 +0000
commite602420e6dee7aab86efa4bad3502afa03cd8648 (patch)
tree97e6f77e8bb333eea1b05b8dba316e918190ad8b
parent5d375a73919b41429cb9a601373d9fabef2a9958 (diff)
downloadqpid-python-e602420e6dee7aab86efa4bad3502afa03cd8648.tar.gz
QPID-2261: fix agent indication heartbeat generation and handling.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@918184 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--extras/qmf/src/py/qmf2/agent.py4
-rw-r--r--extras/qmf/src/py/qmf2/common.py3
-rw-r--r--extras/qmf/src/py/qmf2/console.py27
3 files changed, 16 insertions, 18 deletions
diff --git a/extras/qmf/src/py/qmf2/agent.py b/extras/qmf/src/py/qmf2/agent.py
index b39c8d44aa..cb0cc36ab1 100644
--- a/extras/qmf/src/py/qmf2/agent.py
+++ b/extras/qmf/src/py/qmf2/agent.py
@@ -541,8 +541,8 @@ class Agent(Thread):
"""
Create an agent indication message body identifying this agent
"""
- return {"_name": self.get_name(),
- "_schema_timestamp": self._schema_timestamp}
+ return QmfData.create({"_name": self.get_name(),
+ "_schema_timestamp": self._schema_timestamp}).map_encode()
def _send_reply(self, msg, reply_to):
"""
diff --git a/extras/qmf/src/py/qmf2/common.py b/extras/qmf/src/py/qmf2/common.py
index b3352b750c..7ca7bb5947 100644
--- a/extras/qmf/src/py/qmf2/common.py
+++ b/extras/qmf/src/py/qmf2/common.py
@@ -373,9 +373,6 @@ class QmfData(_mapEncoder):
_utime = long(_map.get(self.KEY_UPDATE_TS, _utime))
_dtime = long(_map.get(self.KEY_DELETE_TS, _dtime))
- if _object_id is None:
- raise Exception("An object_id must be provided.")
-
self._values = _values.copy()
self._subtypes = _subtypes.copy()
self._tag = _tag
diff --git a/extras/qmf/src/py/qmf2/console.py b/extras/qmf/src/py/qmf2/console.py
index b62aa7342b..ec85aec0de 100644
--- a/extras/qmf/src/py/qmf2/console.py
+++ b/extras/qmf/src/py/qmf2/console.py
@@ -1220,12 +1220,10 @@ class Console(Thread):
properties={"method":"request",
"qmf.opcode":OpCode.agent_locate_req},
content=query._predicate)
+ msg.content_type="amqp/list"
msg.reply_to = str(self._address)
msg.correlation_id = str(cid)
- trace.debug("Sending Agent Locate (%s)" % time.time())
- # TRACE
- #log.error("!!! Console %s sending agent locate (%s)" %
- # (self._name, str(msg)))
+ trace.debug("%s Sending Agent Locate (%s)", self._name, str(msg))
try:
self._topic_sender.send(msg)
except SendError, e:
@@ -1685,16 +1683,20 @@ class Console(Thread):
Process a received agent-ind message. This message may be a response to a
agent-locate, or it can be an unsolicited agent announce.
"""
- trace.debug("_handle_agent_ind_msg '%s' (%s)" % (msg, time.time()))
- ai_map = msg.content
- if not ai_map or not isinstance(ai_map, type({})):
- log.warning("Bad agent-ind message received: '%s'" % msg)
+ trace.debug("%s _handle_agent_ind_msg '%s'", self._name, str(msg))
+
+ try:
+ tmp = QmfData.from_map(msg.content)
+ except:
+ log.warning("%s invalid Agent Indication msg format '%s'",
+ self._name, str(msg))
return
- name = ai_map.get("_name")
- if not name:
- log.warning("Bad agent-ind message received: agent name missing"
- " '%s'" % msg)
+
+ try:
+ name = tmp.get_value("_name")
+ except:
+ log.warning("Bad Agent ind msg received: %s", str(msg))
return
correlated = False
@@ -1716,7 +1718,6 @@ class Console(Thread):
# need to create and add a new agent?
matched = False
if self._agent_discovery_filter:
- tmp = QmfData.create(values=ai_map, _object_id="agent-filter")
matched = self._agent_discovery_filter.evaluate(tmp)
if (correlated or matched):