summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/agent
diff options
context:
space:
mode:
authorKen Giusti <kgiusti@apache.org>2010-09-01 18:11:26 +0000
committerKen Giusti <kgiusti@apache.org>2010-09-01 18:11:26 +0000
commit6dfe9cf3e4d9ef8ada24ef1b0f0270c8c2fb8386 (patch)
tree7be439b148c11a1201e2b17b7cc80bd080ab5073 /cpp/src/qpid/agent
parent8a864b72110291c0a7cad8aab91bdef81442729b (diff)
downloadqpid-python-6dfe9cf3e4d9ef8ada24ef1b0f0270c8c2fb8386.tar.gz
QPID-2841: set the TTL in agent heartbeat messages.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@991630 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/agent')
-rw-r--r--cpp/src/qpid/agent/ManagementAgentImpl.cpp14
-rw-r--r--cpp/src/qpid/agent/ManagementAgentImpl.h3
2 files changed, 14 insertions, 3 deletions
diff --git a/cpp/src/qpid/agent/ManagementAgentImpl.cpp b/cpp/src/qpid/agent/ManagementAgentImpl.cpp
index 15e17e13f3..25d24a542c 100644
--- a/cpp/src/qpid/agent/ManagementAgentImpl.cpp
+++ b/cpp/src/qpid/agent/ManagementAgentImpl.cpp
@@ -452,7 +452,12 @@ void ManagementAgentImpl::sendHeartbeat()
getHeartbeatContent(map);
MapCodec::encode(map, content);
- connThreadBody.sendBuffer(content, "", headers, topicExchange, addr_key.str());
+
+ // Set TTL (in msecs) on outgoing heartbeat indications based on the interval
+ // time to prevent stale heartbeats from getting to the consoles.
+
+ connThreadBody.sendBuffer(content, "", headers, topicExchange, addr_key.str(),
+ "amqp/map", interval * 2 * 1000);
QPID_LOG(trace, "SENT AgentHeartbeat name=" << name_address);
}
@@ -1213,7 +1218,8 @@ void ManagementAgentImpl::ConnectionThread::sendBuffer(const string& data,
const Variant::Map headers,
const string& exchange,
const string& routingKey,
- const string& contentType)
+ const string& contentType,
+ uint64_t ttl_msec)
{
Message msg;
Variant::Map::const_iterator i;
@@ -1223,6 +1229,10 @@ void ManagementAgentImpl::ConnectionThread::sendBuffer(const string& data,
if (!contentType.empty())
msg.getMessageProperties().setContentType(contentType);
+
+ if (ttl_msec)
+ msg.getDeliveryProperties().setTtl(ttl_msec);
+
for (i = headers.begin(); i != headers.end(); ++i) {
msg.getHeaders().setString(i->first, i->second.asString());
}
diff --git a/cpp/src/qpid/agent/ManagementAgentImpl.h b/cpp/src/qpid/agent/ManagementAgentImpl.h
index 477526c882..3bd3c6fb8e 100644
--- a/cpp/src/qpid/agent/ManagementAgentImpl.h
+++ b/cpp/src/qpid/agent/ManagementAgentImpl.h
@@ -224,7 +224,8 @@ class ManagementAgentImpl : public ManagementAgent, public client::MessageListen
const qpid::types::Variant::Map headers,
const std::string& exchange,
const std::string& routingKey,
- const std::string& contentType="amqp/map");
+ const std::string& contentType="amqp/map",
+ uint64_t ttl_msec=0);
void sendMessage(qpid::client::Message msg,
const std::string& exchange,
const std::string& routingKey);