diff options
| author | Ted Ross <tross@apache.org> | 2009-08-25 16:48:03 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-08-25 16:48:03 +0000 |
| commit | f121fc29d5d03b9e19ba980c32d4109d6c1d4313 (patch) | |
| tree | 6ec6f4557bf7bdc2a925a243ac54c98634ecbb44 | |
| parent | a176921b2ebc4ca8ae6bd3529e27512c53a21bd7 (diff) | |
| download | qpid-python-f121fc29d5d03b9e19ba980c32d4109d6c1d4313.tar.gz | |
Added management visibility into the alternate exchange and auto-delete attributes
of an exchange.
Note that auto-delete is not implemented for exchanges.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@807712 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Exchange.cpp | 19 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Exchange.h | 2 | ||||
| -rwxr-xr-x | qpid/cpp/src/tests/cli_tests.py | 22 | ||||
| -rwxr-xr-x | qpid/python/commands/qpid-config | 2 | ||||
| -rw-r--r-- | qpid/specs/management-schema.xml | 12 |
5 files changed, 49 insertions, 8 deletions
diff --git a/qpid/cpp/src/qpid/broker/Exchange.cpp b/qpid/cpp/src/qpid/broker/Exchange.cpp index 17fc0e23ca..b1fc1295f3 100644 --- a/qpid/cpp/src/qpid/broker/Exchange.cpp +++ b/qpid/cpp/src/qpid/broker/Exchange.cpp @@ -91,7 +91,9 @@ Exchange::Exchange (const string& _name, Manageable* parent, Broker* b) : ManagementAgent* agent = broker->getManagementAgent(); if (agent != 0) { - mgmtExchange = new _qmf::Exchange (agent, this, parent, _name, durable); + mgmtExchange = new _qmf::Exchange (agent, this, parent, _name); + mgmtExchange->set_durable(durable); + mgmtExchange->set_autoDelete(false); agent->addObject (mgmtExchange); } } @@ -109,7 +111,9 @@ Exchange::Exchange(const string& _name, bool _durable, const qpid::framing::Fiel ManagementAgent* agent = broker->getManagementAgent(); if (agent != 0) { - mgmtExchange = new _qmf::Exchange (agent, this, parent, _name, durable); + mgmtExchange = new _qmf::Exchange (agent, this, parent, _name); + mgmtExchange->set_durable(durable); + mgmtExchange->set_autoDelete(false); mgmtExchange->set_arguments(args); if (!durable) { if (name.empty()) { @@ -139,6 +143,17 @@ Exchange::~Exchange () mgmtExchange->resourceDestroy (); } +void Exchange::setAlternate(Exchange::shared_ptr _alternate) +{ + alternate = _alternate; + if (mgmtExchange != 0) { + if (alternate.get() != 0) + mgmtExchange->set_altExchange(alternate->GetManagementObject()->getObjectId()); + else + mgmtExchange->clr_altExchange(); + } +} + void Exchange::setPersistenceId(uint64_t id) const { if (mgmtExchange != 0 && persistenceId == 0) diff --git a/qpid/cpp/src/qpid/broker/Exchange.h b/qpid/cpp/src/qpid/broker/Exchange.h index ca8525d55e..c1e878200f 100644 --- a/qpid/cpp/src/qpid/broker/Exchange.h +++ b/qpid/cpp/src/qpid/broker/Exchange.h @@ -132,7 +132,7 @@ public: qpid::framing::FieldTable& getArgs() { return args; } Exchange::shared_ptr getAlternate() { return alternate; } - void setAlternate(Exchange::shared_ptr _alternate) { alternate = _alternate; } + void setAlternate(Exchange::shared_ptr _alternate); void incAlternateUsers() { alternateUsers++; } void decAlternateUsers() { alternateUsers--; } bool inUseAsAlternate() { return alternateUsers > 0; } diff --git a/qpid/cpp/src/tests/cli_tests.py b/qpid/cpp/src/tests/cli_tests.py index 2af1a20a87..4309b66271 100755 --- a/qpid/cpp/src/tests/cli_tests.py +++ b/qpid/cpp/src/tests/cli_tests.py @@ -123,6 +123,28 @@ class CliTests(TestBase010): found = True self.assertEqual(found, False) + def test_qpid_config_altex(self): + self.startQmf(); + qmf = self.qmf + exName = "testalt" + altName = "amq.direct" + + ret = os.system(self.command(" add exchange topic %s --alternate-exchange=%s" % (exName, altName))) + self.assertEqual(ret, 0) + + exchanges = qmf.getObjects(_class="exchange") + found = False + for exchange in exchanges: + if exchange.name == altName: + self.assertEqual(exchange.altExchange, None) + + if exchange.name == exName: + found = True + if not exchange.altExchange: + self.fail("Alternate exchange not set") + self.assertEqual(exchange._altExchange_.name, altName) + self.assertEqual(found, True) + def test_qpid_route(self): self.startQmf(); qmf = self.qmf diff --git a/qpid/python/commands/qpid-config b/qpid/python/commands/qpid-config index c4ea5c5f2d..a10753f011 100755 --- a/qpid/python/commands/qpid-config +++ b/qpid/python/commands/qpid-config @@ -190,6 +190,8 @@ class BrokerManager: if ex.durable: print "--durable", if MSG_SEQUENCE in args and args[MSG_SEQUENCE] == 1: print "--sequence", if IVE in args and args[IVE] == 1: print "--ive", + if ex.altExchange: + print "--alternate-exchange=%s" % ex._altExchange_.name, print def ExchangeListRecurse (self, filter): diff --git a/qpid/specs/management-schema.xml b/qpid/specs/management-schema.xml index bc38350a45..e72ba1cdd7 100644 --- a/qpid/specs/management-schema.xml +++ b/qpid/specs/management-schema.xml @@ -164,11 +164,13 @@ =============================================================== --> <class name="Exchange"> - <property name="vhostRef" type="objId" references="Vhost" access="RC" index="y" parentRef="y"/> - <property name="name" type="sstr" access="RC" index="y"/> - <property name="type" type="sstr" access="RO"/> - <property name="durable" type="bool" access="RC"/> - <property name="arguments" type="map" access="RO" desc="Arguments supplied in exchange.declare"/> + <property name="vhostRef" type="objId" references="Vhost" access="RC" index="y" parentRef="y"/> + <property name="name" type="sstr" access="RC" index="y"/> + <property name="type" type="sstr" access="RO"/> + <property name="durable" type="bool" access="RO"/> + <property name="autoDelete" type="bool" access="RO"/> + <property name="altExchange" type="objId" access="RO" optional="y"/> + <property name="arguments" type="map" access="RO" desc="Arguments supplied in exchange.declare"/> <statistic name="producerCount" type="hilo32" desc="Current producers on exchange"/> <statistic name="bindingCount" type="hilo32" desc="Current bindings"/> |
