summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/Link.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-11-13 22:04:59 +0000
committerTed Ross <tross@apache.org>2008-11-13 22:04:59 +0000
commitfde0d6af59f7ff8d958c56aab6d57be3b491222a (patch)
tree15e7f08a879b5809d878ffd3e61b30aaa1b5b487 /cpp/src/qpid/broker/Link.cpp
parent0272430b4dd7ad2f05492d527d5f5f1bb50e7356 (diff)
downloadqpid-python-fde0d6af59f7ff8d958c56aab6d57be3b491222a.tar.gz
QPID-1461 - Added qmf event support for connections.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@713838 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Link.cpp')
-rw-r--r--cpp/src/qpid/broker/Link.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/cpp/src/qpid/broker/Link.cpp b/cpp/src/qpid/broker/Link.cpp
index b026c89b75..bda9c80f0b 100644
--- a/cpp/src/qpid/broker/Link.cpp
+++ b/cpp/src/qpid/broker/Link.cpp
@@ -23,7 +23,8 @@
#include "LinkRegistry.h"
#include "Broker.h"
#include "Connection.h"
-#include "qpid/agent/ManagementAgent.h"
+#include "qmf/org/apache/qpid/broker/EventBrokerLinkUp.h"
+#include "qmf/org/apache/qpid/broker/EventBrokerLinkDown.h"
#include "boost/bind.hpp"
#include "qpid/log/Statement.h"
#include "qpid/framing/enum.h"
@@ -40,6 +41,7 @@ using qpid::management::ManagementObject;
using qpid::management::Manageable;
using qpid::management::Args;
using qpid::sys::Mutex;
+using std::stringstream;
namespace _qmf = qmf::org::apache::qpid::broker;
Link::Link(LinkRegistry* _links,
@@ -62,11 +64,12 @@ Link::Link(LinkRegistry* _links,
currentInterval(1),
closing(false),
channelCounter(1),
- connection(0)
+ connection(0),
+ agent(0)
{
if (parent != 0)
{
- ManagementAgent* agent = ManagementAgent::Singleton::getInstance();
+ agent = ManagementAgent::Singleton::getInstance();
if (agent != 0)
{
mgmtObject = new _qmf::Link(agent, this, parent, _host, _port, _transport, _durable);
@@ -123,8 +126,11 @@ void Link::startConnectionLH ()
void Link::established ()
{
Mutex::ScopedLock mutex(lock);
+ stringstream addr;
+ addr << host << ":" << port;
- QPID_LOG (info, "Inter-broker link established to " << host << ":" << port);
+ QPID_LOG (info, "Inter-broker link established to " << addr.str());
+ agent->raiseEvent(_qmf::EventBrokerLinkUp(addr.str()));
setStateLH(STATE_OPERATIONAL);
currentInterval = 1;
visitCount = 0;
@@ -138,8 +144,12 @@ void Link::closed (int, std::string text)
connection = 0;
- if (state == STATE_OPERATIONAL)
- QPID_LOG (warning, "Inter-broker link disconnected from " << host << ":" << port);
+ if (state == STATE_OPERATIONAL) {
+ stringstream addr;
+ addr << host << ":" << port;
+ QPID_LOG (warning, "Inter-broker link disconnected from " << addr.str());
+ agent->raiseEvent(_qmf::EventBrokerLinkDown(addr.str()));
+ }
for (Bridges::iterator i = active.begin(); i != active.end(); i++) {
(*i)->cancel();