diff options
| author | Alan Conway <aconway@apache.org> | 2014-09-26 15:38:02 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2014-09-26 15:38:02 +0000 |
| commit | 103cf31c6e047229b9a74ec26a42c09e1ac6ada9 (patch) | |
| tree | c5a4af4643dff050dd3c5236761f1c7256713d5a /qpid | |
| parent | 496a602e2fc76224f835b379a3b301f35f2fac8e (diff) | |
| download | qpid-python-103cf31c6e047229b9a74ec26a42c09e1ac6ada9.tar.gz | |
QPID-6118: Add qmf shutdown command to the broker
QMF shutdown command implemented on broker.
- ACL to control shutdown: acl deny all access method name=shutdown
- Added "qpid-config shutdown" command to shut down the broker.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1627811 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Broker.cpp | 6 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/management-schema.xml | 3 | ||||
| -rwxr-xr-x | qpid/tools/src/py/qpid-config | 14 |
3 files changed, 18 insertions, 5 deletions
diff --git a/qpid/cpp/src/qpid/broker/Broker.cpp b/qpid/cpp/src/qpid/broker/Broker.cpp index e4268255a1..9e2e12c840 100644 --- a/qpid/cpp/src/qpid/broker/Broker.cpp +++ b/qpid/cpp/src/qpid/broker/Broker.cpp @@ -689,6 +689,11 @@ Manageable::status_t Broker::ManagementMethod (uint32_t methodId, status = queueRedirect(srcQueue, tgtQueue, getCurrentPublisher()); break; } + case _qmf::Broker::METHOD_SHUTDOWN : + { + QPID_LOG (info, "Broker received shutdown command"); + shutdown(); + } default: QPID_LOG (debug, "Broker ManagementMethod not implemented: id=" << methodId << "]"); status = Manageable::STATUS_NOT_IMPLEMENTED; @@ -1289,7 +1294,6 @@ void Broker::queueRedirectDestroy(Queue::shared_ptr srcQ, } } - const Broker::TransportInfo& Broker::getTransportInfo(const std::string& name) const { static TransportInfo nullTransportInfo; TransportMap::const_iterator i diff --git a/qpid/cpp/src/qpid/broker/management-schema.xml b/qpid/cpp/src/qpid/broker/management-schema.xml index d6bbd01a09..debc1a4af2 100644 --- a/qpid/cpp/src/qpid/broker/management-schema.xml +++ b/qpid/cpp/src/qpid/broker/management-schema.xml @@ -194,6 +194,9 @@ <arg name="targetQueue" dir="I" type="sstr" desc="Redirect target queue. Blank disables redirect."/> </method> + <method name="shutdown" desc="Shutdown the broker"> + </method> + </class> <!-- diff --git a/qpid/tools/src/py/qpid-config b/qpid/tools/src/py/qpid-config index 3fc27ab241..ac93954484 100755 --- a/qpid/tools/src/py/qpid-config +++ b/qpid/tools/src/py/qpid-config @@ -28,7 +28,7 @@ import locale home = os.environ.get("QPID_TOOLS_HOME", os.path.normpath("/usr/share/qpid-tools")) sys.path.append(os.path.join(home, "python")) -from qpid.messaging import Connection +from qpid.messaging import Connection, ConnectionError from qpidtoollibs import BrokerAgent from qpidtoollibs import Display, Header @@ -47,7 +47,8 @@ Usage: qpid-config [OPTIONS] qpid-config [OPTIONS] reload-acl qpid-config [OPTIONS] add <type> <name> [--argument <property-name>=<property-value>] qpid-config [OPTIONS] del <type> <name> - qpid-config [OPTIONS] list <type> [--show-property <property-name>]""" + qpid-config [OPTIONS] list <type> [--show-property <property-name>] + qpid-config [OPTIONS] shutdown""" description = """ Examples: @@ -813,7 +814,12 @@ def main(argv=None): headers = [Header(a) for a in desired] rows = [tuple([_clean_ref(o.get(a, "n/a")) for a in desired]) for o in objects] display.formattedTable("Objects of type '%s'" % modifier, headers, rows) - + elif cmd == "shutdown": + try: + bm.broker._method("shutdown", {}) + except ConnectionError: + pass # Normal, the broker has been shut down! + bm.conn = None # Don't try to close again else: Usage() except KeyboardInterrupt: @@ -846,5 +852,5 @@ def main(argv=None): if __name__ == "__main__": - sys.exit(main()) + sys.exit(main()) |
