summaryrefslogtreecommitdiff
path: root/qpid
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2008-04-08 19:29:08 +0000
committerKim van der Riet <kpvdr@apache.org>2008-04-08 19:29:08 +0000
commitc89fe1d8ef23cb6f3f2c60623dfdac08216baa06 (patch)
tree2a0721feec5f8ff8d999bf1c90ac7f5e6c048e08 /qpid
parenta0d0bae55a8cfde80403f6f1b182d36524a74981 (diff)
downloadqpid-python-c89fe1d8ef23cb6f3f2c60623dfdac08216baa06.tar.gz
Patch from Ted Ross: QPID-907: Management Improvements for C++ Broker and Store
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@646045 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
-rw-r--r--qpid/cpp/src/qpid/broker/Broker.cpp2
-rw-r--r--qpid/cpp/src/qpid/broker/BrokerAdapter.cpp2
-rw-r--r--qpid/cpp/src/qpid/broker/DirectExchange.cpp4
-rw-r--r--qpid/cpp/src/qpid/broker/Exchange.cpp7
-rw-r--r--qpid/cpp/src/qpid/broker/Exchange.h9
-rw-r--r--qpid/cpp/src/qpid/broker/FanOutExchange.cpp2
-rw-r--r--qpid/cpp/src/qpid/broker/HeadersExchange.cpp4
-rw-r--r--qpid/cpp/src/qpid/broker/MessageStore.h7
-rw-r--r--qpid/cpp/src/qpid/broker/MessageStoreModule.cpp9
-rw-r--r--qpid/cpp/src/qpid/broker/MessageStoreModule.h4
-rw-r--r--qpid/cpp/src/qpid/broker/NullMessageStore.cpp4
-rw-r--r--qpid/cpp/src/qpid/broker/NullMessageStore.h4
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.cpp6
-rw-r--r--qpid/cpp/src/qpid/broker/SessionAdapter.cpp2
-rw-r--r--qpid/cpp/src/qpid/broker/TopicExchange.cpp2
-rw-r--r--qpid/cpp/src/qpid/management/ManagementObject.h1
-rwxr-xr-xqpid/python/commands/qpid-config110
-rw-r--r--qpid/python/mgmt-cli/managementdata.py6
-rw-r--r--qpid/python/qpid/management.py4
-rw-r--r--qpid/specs/management-schema.xml9
-rw-r--r--qpid/specs/management-types.xml1
21 files changed, 130 insertions, 69 deletions
diff --git a/qpid/cpp/src/qpid/broker/Broker.cpp b/qpid/cpp/src/qpid/broker/Broker.cpp
index 03036fb825..d834399180 100644
--- a/qpid/cpp/src/qpid/broker/Broker.cpp
+++ b/qpid/cpp/src/qpid/broker/Broker.cpp
@@ -196,7 +196,7 @@ void Broker::declareStandardExchange(const std::string& name, const std::string&
bool storeEnabled = store != NULL;
std::pair<Exchange::shared_ptr, bool> status = exchanges.declare(name, type, storeEnabled);
if (status.second && storeEnabled) {
- store->create(*status.first);
+ store->create(*status.first, framing::FieldTable ());
}
}
diff --git a/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp b/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
index d7fd20db1d..ea964ef3a3 100644
--- a/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
+++ b/qpid/cpp/src/qpid/broker/BrokerAdapter.cpp
@@ -65,7 +65,7 @@ void BrokerAdapter::ExchangeHandlerImpl::declare(uint16_t /*ticket*/, const stri
std::pair<Exchange::shared_ptr, bool> response = getBroker().getExchanges().declare(exchange, type, durable, args);
if (response.second) {
if (durable) {
- getBroker().getStore().create(*response.first);
+ getBroker().getStore().create(*response.first, args);
}
if (alternate) {
response.first->setAlternate(alternate);
diff --git a/qpid/cpp/src/qpid/broker/DirectExchange.cpp b/qpid/cpp/src/qpid/broker/DirectExchange.cpp
index 43b707a5c8..72021b8d98 100644
--- a/qpid/cpp/src/qpid/broker/DirectExchange.cpp
+++ b/qpid/cpp/src/qpid/broker/DirectExchange.cpp
@@ -54,7 +54,8 @@ bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, con
Binding::shared_ptr binding (new Binding (routingKey, queue, this));
bindings[routingKey].push_back(binding);
if (mgmtExchange.get() != 0) {
- mgmtExchange->inc_bindings ();
+ mgmtExchange->inc_bindings();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
}
return true;
} else{
@@ -78,6 +79,7 @@ bool DirectExchange::unbind(Queue::shared_ptr queue, const string& routingKey, c
}
if (mgmtExchange.get() != 0) {
mgmtExchange->dec_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
}
return true;
} else {
diff --git a/qpid/cpp/src/qpid/broker/Exchange.cpp b/qpid/cpp/src/qpid/broker/Exchange.cpp
index 83466085bc..47d616cf16 100644
--- a/qpid/cpp/src/qpid/broker/Exchange.cpp
+++ b/qpid/cpp/src/qpid/broker/Exchange.cpp
@@ -103,8 +103,9 @@ ManagementObject::shared_ptr Exchange::GetManagementObject (void) const
return dynamic_pointer_cast<ManagementObject> (mgmtExchange);
}
-Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchange* parent)
- : queue(_queue), key(_key)
+Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchange* parent,
+ FieldTable _args)
+ : queue(_queue), key(_key), args(_args)
{
if (parent != 0)
{
@@ -116,7 +117,7 @@ Exchange::Binding::Binding(const string& _key, Queue::shared_ptr _queue, Exchang
{
uint64_t queueId = mo->getObjectId();
mgmtBinding = management::Binding::shared_ptr
- (new management::Binding (this, (Manageable*) parent, queueId, key));
+ (new management::Binding (this, (Manageable*) parent, queueId, key, args));
agent->addObject (mgmtBinding);
}
}
diff --git a/qpid/cpp/src/qpid/broker/Exchange.h b/qpid/cpp/src/qpid/broker/Exchange.h
index e9f5b3965a..7902eb4219 100644
--- a/qpid/cpp/src/qpid/broker/Exchange.h
+++ b/qpid/cpp/src/qpid/broker/Exchange.h
@@ -51,12 +51,13 @@ namespace qpid {
typedef boost::shared_ptr<Binding> shared_ptr;
typedef std::vector<Binding::shared_ptr> vector;
- Queue::shared_ptr queue;
- const std::string key;
- const qpid::framing::FieldTable args;
+ Queue::shared_ptr queue;
+ const std::string key;
+ const framing::FieldTable args;
management::Binding::shared_ptr mgmtBinding;
- Binding(const std::string& key, const Queue::shared_ptr queue, Exchange* parent = 0);
+ Binding(const std::string& key, const Queue::shared_ptr queue, Exchange* parent = 0,
+ framing::FieldTable args = framing::FieldTable ());
~Binding ();
management::ManagementObject::shared_ptr GetManagementObject () const;
management::Manageable::status_t ManagementMethod (uint32_t methodId, management::Args& args);
diff --git a/qpid/cpp/src/qpid/broker/FanOutExchange.cpp b/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
index 714d4ea444..df723d2c8f 100644
--- a/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
+++ b/qpid/cpp/src/qpid/broker/FanOutExchange.cpp
@@ -54,6 +54,7 @@ bool FanOutExchange::bind(Queue::shared_ptr queue, const string& /*routingKey*/,
bindings.push_back(binding);
if (mgmtExchange.get() != 0) {
mgmtExchange->inc_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
}
return true;
} else {
@@ -73,6 +74,7 @@ bool FanOutExchange::unbind(Queue::shared_ptr queue, const string& /*routingKey*
bindings.erase(i);
if (mgmtExchange.get() != 0) {
mgmtExchange->dec_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
}
return true;
} else {
diff --git a/qpid/cpp/src/qpid/broker/HeadersExchange.cpp b/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
index 886ad4767b..5196099ed5 100644
--- a/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
+++ b/qpid/cpp/src/qpid/broker/HeadersExchange.cpp
@@ -85,12 +85,13 @@ bool HeadersExchange::bind(Queue::shared_ptr queue, const string& bindingKey, co
break;
if (i == bindings.end()) {
- Binding::shared_ptr binding (new Binding (bindingKey, queue, this));
+ Binding::shared_ptr binding (new Binding (bindingKey, queue, this, *args));
HeaderMap headerMap(*args, binding);
bindings.push_back(headerMap);
if (mgmtExchange.get() != 0) {
mgmtExchange->inc_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
}
return true;
} else {
@@ -115,6 +116,7 @@ bool HeadersExchange::unbind(Queue::shared_ptr queue, const string& bindingKey,
bindings.erase(i);
if (mgmtExchange.get() != 0) {
mgmtExchange->dec_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
}
return true;
} else {
diff --git a/qpid/cpp/src/qpid/broker/MessageStore.h b/qpid/cpp/src/qpid/broker/MessageStore.h
index 72633b04a5..76469ccc50 100644
--- a/qpid/cpp/src/qpid/broker/MessageStore.h
+++ b/qpid/cpp/src/qpid/broker/MessageStore.h
@@ -26,6 +26,7 @@
#include "PersistableQueue.h"
#include "RecoveryManager.h"
#include "TransactionalStore.h"
+#include "qpid/framing/FieldTable.h"
#include <qpid/Options.h>
@@ -56,7 +57,8 @@ public:
/**
* Record the existence of a durable queue
*/
- virtual void create(PersistableQueue& queue) = 0;
+ virtual void create(PersistableQueue& queue,
+ const framing::FieldTable& args) = 0;
/**
* Destroy a durable queue
*/
@@ -65,7 +67,8 @@ public:
/**
* Record the existence of a durable exchange
*/
- virtual void create(const PersistableExchange& exchange) = 0;
+ virtual void create(const PersistableExchange& exchange,
+ const framing::FieldTable& args) = 0;
/**
* Destroy a durable exchange
*/
diff --git a/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp b/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
index 5d684ce6d7..e02c87f069 100644
--- a/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
+++ b/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
@@ -27,6 +27,7 @@
using boost::intrusive_ptr;
using namespace qpid::broker;
+using qpid::framing::FieldTable;
MessageStoreModule::MessageStoreModule(MessageStore* _store) : store(_store) {}
@@ -37,9 +38,9 @@ MessageStoreModule::~MessageStoreModule()
bool MessageStoreModule::init(const Options*) { return true; }
-void MessageStoreModule::create(PersistableQueue& queue)
+void MessageStoreModule::create(PersistableQueue& queue, const FieldTable& args)
{
- TRANSFER_EXCEPTION(store->create(queue));
+ TRANSFER_EXCEPTION(store->create(queue, args));
}
void MessageStoreModule::destroy(PersistableQueue& queue)
@@ -47,9 +48,9 @@ void MessageStoreModule::destroy(PersistableQueue& queue)
TRANSFER_EXCEPTION(store->destroy(queue));
}
-void MessageStoreModule::create(const PersistableExchange& exchange)
+void MessageStoreModule::create(const PersistableExchange& exchange, const FieldTable& args)
{
- TRANSFER_EXCEPTION(store->create(exchange));
+ TRANSFER_EXCEPTION(store->create(exchange, args));
}
void MessageStoreModule::destroy(const PersistableExchange& exchange)
diff --git a/qpid/cpp/src/qpid/broker/MessageStoreModule.h b/qpid/cpp/src/qpid/broker/MessageStoreModule.h
index abc0fbfd7a..c7ad76d8bb 100644
--- a/qpid/cpp/src/qpid/broker/MessageStoreModule.h
+++ b/qpid/cpp/src/qpid/broker/MessageStoreModule.h
@@ -49,9 +49,9 @@ public:
void abort(TransactionContext& txn);
void collectPreparedXids(std::set<std::string>& xids);
- void create(PersistableQueue& queue);
+ void create(PersistableQueue& queue, const framing::FieldTable& args);
void destroy(PersistableQueue& queue);
- void create(const PersistableExchange& exchange);
+ void create(const PersistableExchange& exchange, const framing::FieldTable& args);
void destroy(const PersistableExchange& exchange);
void bind(const PersistableExchange& exchange, const PersistableQueue& queue,
const std::string& key, const framing::FieldTable& args);
diff --git a/qpid/cpp/src/qpid/broker/NullMessageStore.cpp b/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
index 0dc7dbb82d..8936b0440f 100644
--- a/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
+++ b/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
@@ -53,7 +53,7 @@ NullMessageStore::NullMessageStore(bool _warn) : warn(_warn){}
bool NullMessageStore::init(const Options* /*options*/) {return true;}
-void NullMessageStore::create(PersistableQueue& queue)
+void NullMessageStore::create(PersistableQueue& queue, const framing::FieldTable& /*args*/)
{
QPID_LOG(info, "Queue '" << queue.getName()
<< "' will not be durable. Persistence not enabled.");
@@ -63,7 +63,7 @@ void NullMessageStore::destroy(PersistableQueue&)
{
}
-void NullMessageStore::create(const PersistableExchange& exchange)
+void NullMessageStore::create(const PersistableExchange& exchange, const framing::FieldTable& /*args*/)
{
QPID_LOG(info, "Exchange'" << exchange.getName()
<< "' will not be durable. Persistence not enabled.");
diff --git a/qpid/cpp/src/qpid/broker/NullMessageStore.h b/qpid/cpp/src/qpid/broker/NullMessageStore.h
index 7cde4db70b..96d1c483a2 100644
--- a/qpid/cpp/src/qpid/broker/NullMessageStore.h
+++ b/qpid/cpp/src/qpid/broker/NullMessageStore.h
@@ -48,9 +48,9 @@ public:
virtual void abort(TransactionContext& txn);
virtual void collectPreparedXids(std::set<std::string>& xids);
- virtual void create(PersistableQueue& queue);
+ virtual void create(PersistableQueue& queue, const framing::FieldTable& args);
virtual void destroy(PersistableQueue& queue);
- virtual void create(const PersistableExchange& exchange);
+ virtual void create(const PersistableExchange& exchange, const framing::FieldTable& args);
virtual void destroy(const PersistableExchange& exchange);
virtual void bind(const PersistableExchange& exchange, const PersistableQueue& queue,
diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp
index 7ec72951df..591e9796d6 100644
--- a/qpid/cpp/src/qpid/broker/Queue.cpp
+++ b/qpid/cpp/src/qpid/broker/Queue.cpp
@@ -474,7 +474,7 @@ void Queue::create(const FieldTable& _settings)
{
settings = _settings;
if (store) {
- store->create(*this);
+ store->create(*this, _settings);
}
configure(_settings);
}
@@ -484,11 +484,13 @@ void Queue::configure(const FieldTable& _settings)
std::auto_ptr<QueuePolicy> _policy(new QueuePolicy(_settings));
if (_policy->getMaxCount() || _policy->getMaxSize()) {
setPolicy(_policy);
- }
+ }
if (owner) {
noLocal = _settings.get(qpidNoLocal);
QPID_LOG(debug, "Configured queue with no-local=" << noLocal);
}
+ if (mgmtObject.get() != 0)
+ mgmtObject->set_arguments (_settings);
}
void Queue::destroy()
diff --git a/qpid/cpp/src/qpid/broker/SessionAdapter.cpp b/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
index 497f381807..d30a1dc696 100644
--- a/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
+++ b/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
@@ -66,7 +66,7 @@ void SessionAdapter::ExchangeHandlerImpl::declare(const string& exchange, const
std::pair<Exchange::shared_ptr, bool> response = getBroker().getExchanges().declare(exchange, type, durable, args);
if (response.second) {
if (durable) {
- getBroker().getStore().create(*response.first);
+ getBroker().getStore().create(*response.first, args);
}
if (alternate) {
response.first->setAlternate(alternate);
diff --git a/qpid/cpp/src/qpid/broker/TopicExchange.cpp b/qpid/cpp/src/qpid/broker/TopicExchange.cpp
index 5330ee4fd0..1c4fa2ea7a 100644
--- a/qpid/cpp/src/qpid/broker/TopicExchange.cpp
+++ b/qpid/cpp/src/qpid/broker/TopicExchange.cpp
@@ -139,6 +139,7 @@ bool TopicExchange::bind(Queue::shared_ptr queue, const string& routingKey, cons
bindings[routingPattern].push_back(binding);
if (mgmtExchange.get() != 0) {
mgmtExchange->inc_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->inc_bindings();
}
return true;
}
@@ -159,6 +160,7 @@ bool TopicExchange::unbind(Queue::shared_ptr queue, const string& routingKey, co
if(qv.empty()) bindings.erase(bi);
if (mgmtExchange.get() != 0) {
mgmtExchange->dec_bindings ();
+ dynamic_pointer_cast<management::Queue>(queue->GetManagementObject())->dec_bindings();
}
return true;
}
diff --git a/qpid/cpp/src/qpid/management/ManagementObject.h b/qpid/cpp/src/qpid/management/ManagementObject.h
index ca8a0fd558..48a3372d16 100644
--- a/qpid/cpp/src/qpid/management/ManagementObject.h
+++ b/qpid/cpp/src/qpid/management/ManagementObject.h
@@ -60,6 +60,7 @@ class ManagementObject
static const uint8_t TYPE_FLOAT = 12;
static const uint8_t TYPE_DOUBLE = 13;
static const uint8_t TYPE_UUID = 14;
+ static const uint8_t TYPE_FTABLE = 15;
static const uint8_t ACCESS_RC = 1;
static const uint8_t ACCESS_RW = 2;
diff --git a/qpid/python/commands/qpid-config b/qpid/python/commands/qpid-config
index be0fc5a67f..3fd8e93c63 100755
--- a/qpid/python/commands/qpid-config
+++ b/qpid/python/commands/qpid-config
@@ -30,28 +30,43 @@ from qpid.peer import Closed
from qpid.client import Client
from time import sleep
-defspecpath = "/usr/share/amqp/amqp.0-10-preview.xml"
-specpath = defspecpath
-recursive = False
-host = "localhost"
+_defspecpath = "/usr/share/amqp/amqp.0-10-preview.xml"
+_specpath = _defspecpath
+_recursive = False
+_host = "localhost"
+_durable = False
+_fileCount = 8
+_fileSize = 24
+
+FILECOUNT = "qpid.file_count"
+FILESIZE = "qpid.file_size"
def Usage ():
print "Usage: qpid-config [OPTIONS]"
print " qpid-config [OPTIONS] exchanges [filter-string]"
print " qpid-config [OPTIONS] queues [filter-string]"
- print " qpid-config [OPTIONS] add exchange <type> <name> [durable]"
+ print " qpid-config [OPTIONS] add exchange <type> <name> [AddExchangeOptions]"
print " qpid-config [OPTIONS] del exchange <name>"
- print " qpid-config [OPTIONS] add queue <name> [durable]"
+ print " qpid-config [OPTIONS] add queue <name> [AddQueueOptions]"
print " qpid-config [OPTIONS] del queue <name>"
print " qpid-config [OPTIONS] bind <exchange-name> <queue-name> [binding-key]"
print " qpid-config [OPTIONS] unbind <exchange-name> <queue-name> [binding-key]"
print
print "Options:"
- print " -b show bindings"
- print " -a <broker-addr> default: localhost"
+ print " -b [ --bindings ] Show bindings in queue or exchange list"
+ print " -a [ --broker-addr ] Address (localhost) Address of qpidd broker"
print " broker-addr is in the form: hostname | ip-address [:<port>]"
print " ex: localhost, 10.1.1.7:10000, broker-host:10000"
- print " -s <amqp-spec-file> default:", defspecpath
+ print " -s [ --spec-file] Path (" + _defspecpath + ")"
+ print " AMQP specification file"
+ print
+ print "Add Queue Options:"
+ print " --durable Queue is durable"
+ print " --file-count N (8) Number of files in queue's persistence journal"
+ print " --file-size N (24) File size in pages (64Kib/page)"
+ print
+ print "Add Exchange Options:"
+ print " --durable Exchange is durable"
print
sys.exit (1)
@@ -80,7 +95,7 @@ class BrokerManager:
def ConnectToBroker (self):
try:
- self.spec = qpid.spec.load (specpath)
+ self.spec = qpid.spec.load (_specpath)
self.client = Client (self.broker.host, self.broker.port, self.spec)
self.client.start ({"LOGIN":"guest","PASSWORD":"guest"})
self.channel = self.client.channel (1)
@@ -109,12 +124,12 @@ class BrokerManager:
print
print " Total Queues: %d" % len (queues)
- durable = 0
+ _durable = 0
for queue in queues:
if queue.durable:
- durable = durable + 1
- print " durable: %d" % durable
- print " non-durable: %d" % (len (queues) - durable)
+ _durable = _durable + 1
+ print " durable: %d" % _durable
+ print " non-durable: %d" % (len (queues) - _durable)
def ExchangeList (self, filter):
self.ConnectToBroker ()
@@ -153,13 +168,25 @@ class BrokerManager:
mc = self.mclient
mch = self.mchannel
mc.syncWaitForStable (mch)
- queues = mc.syncGetObjects (mch, "queue")
- print "Durable AutoDel Excl Bindings Queue Name"
- print "==============================================================="
+ queues = mc.syncGetObjects (mch, "queue")
+ journals = mc.syncGetObjects (mch, "journal")
+ print " Store Size"
+ print "Durable AutoDel Excl Bindings (files x file pages) Queue Name"
+ print "==========================================================================================="
for q in queues:
if self.match (q.name, filter):
- print "%4c%9c%7c%10d %s" % (tf (q.durable), tf (q.autoDelete), tf (q.exclusive),
- q.bindings, q.name)
+ args = q.arguments
+ if q.durable and FILESIZE in args and FILECOUNT in args:
+ fs = int (args[FILESIZE])
+ fc = int (args[FILECOUNT])
+ print "%4c%9c%7c%10d%11dx%-14d%s" % \
+ (YN (q.durable), YN (q.autoDelete),
+ YN (q.exclusive), q.bindings, fc, fs, q.name)
+ else:
+ if not _durable:
+ print "%4c%9c%7c%10d %s" % \
+ (YN (q.durable), YN (q.autoDelete),
+ YN (q.exclusive), q.bindings, q.name)
def QueueListRecurse (self, filter):
self.ConnectToBroker ()
@@ -188,9 +215,6 @@ class BrokerManager:
self.ConnectToBroker ()
etype = args[0]
ename = args[1]
- _durable = False
- if len (args) > 2 and args[2] == "durable":
- _durable = True
try:
self.channel.exchange_declare (exchange=ename, type=etype, durable=_durable)
@@ -212,13 +236,14 @@ class BrokerManager:
if len (args) < 1:
Usage ()
self.ConnectToBroker ()
- qname = args[0]
- _durable = False
- if len (args) > 1 and args[1] == "durable":
- _durable = True
+ qname = args[0]
+ declArgs = {}
+ if _durable:
+ declArgs[FILECOUNT] = _fileCount
+ declArgs[FILESIZE] = _fileSize
try:
- self.channel.queue_declare (queue=qname, durable=_durable)
+ self.channel.queue_declare (queue=qname, durable=_durable, arguments=declArgs)
except Closed, e:
print "Failed:", e
@@ -276,7 +301,7 @@ class BrokerManager:
return False
return True
-def tf (bool):
+def YN (bool):
if bool:
return 'Y'
return 'N'
@@ -286,21 +311,28 @@ def tf (bool):
##
try:
- (optlist, cargs) = getopt.getopt (sys.argv[1:], "s:a:b")
+ longOpts = ("durable", "spec-file=", "bindings", "broker-addr=", "file-count=", "file-size=")
+ (optlist, cargs) = getopt.gnu_getopt (sys.argv[1:], "s:a:b", longOpts)
except:
Usage ()
for opt in optlist:
- if opt[0] == "-s":
- specpath = opt[1]
- if opt[0] == "-b":
- recursive = True
- if opt[0] == "-a":
- host = opt[1]
+ if opt[0] == "-s" or opt[0] == "--spec-file":
+ _specpath = opt[1]
+ if opt[0] == "-b" or opt[0] == "--bindings":
+ _recursive = True
+ if opt[0] == "-a" or opt[0] == "--broker-addr":
+ _host = opt[1]
+ if opt[0] == "--durable":
+ _durable = True
+ if opt[0] == "--file-count":
+ _fileCount = int (opt[1])
+ if opt[0] == "--file-size":
+ _fileSize = int (opt[1])
nargs = len (cargs)
-bm = BrokerManager ()
-bm.SetBroker (Broker (host))
+bm = BrokerManager ()
+bm.SetBroker (Broker (_host))
if nargs == 0:
bm.Overview ()
@@ -310,12 +342,12 @@ else:
if nargs > 1:
modifier = cargs[1]
if cmd[0] == 'e':
- if recursive:
+ if _recursive:
bm.ExchangeListRecurse (modifier)
else:
bm.ExchangeList (modifier)
elif cmd[0] == 'q':
- if recursive:
+ if _recursive:
bm.QueueListRecurse (modifier)
else:
bm.QueueList (modifier)
diff --git a/qpid/python/mgmt-cli/managementdata.py b/qpid/python/mgmt-cli/managementdata.py
index 1524e2c919..00fc0ec09e 100644
--- a/qpid/python/mgmt-cli/managementdata.py
+++ b/qpid/python/mgmt-cli/managementdata.py
@@ -199,6 +199,8 @@ class ManagementData:
return "True"
elif typecode == 14:
return str (UUID (bytes=value))
+ elif typecode == 15:
+ return str (value)
return "*type-error*"
def getObjIndex (self, className, config):
@@ -268,6 +270,10 @@ class ManagementData:
return "float"
elif typecode == 13:
return "double"
+ elif typecode == 14:
+ return "uuid"
+ elif typecode == 15:
+ return "field-table"
else:
raise ValueError ("Invalid type code: %d" % typecode)
diff --git a/qpid/python/qpid/management.py b/qpid/python/qpid/management.py
index b3bc068166..b08566ee4f 100644
--- a/qpid/python/qpid/management.py
+++ b/qpid/python/qpid/management.py
@@ -351,6 +351,8 @@ class managementClient:
codec.encode_double (double (value))
elif typecode == 14: # UUID
codec.encode_uuid (value)
+ elif typecode == 15: # FTABLE
+ codec.encode_table (value)
else:
raise ValueError ("Invalid type code: %d" % typecode)
@@ -384,6 +386,8 @@ class managementClient:
data = codec.decode_double ()
elif typecode == 14: # UUID
data = codec.decode_uuid ()
+ elif typecode == 15: # FTABLE
+ data = codec.decode_table ()
else:
raise ValueError ("Invalid type code: %d" % typecode)
return data
diff --git a/qpid/specs/management-schema.xml b/qpid/specs/management-schema.xml
index df7fcb625d..e37921a8f5 100644
--- a/qpid/specs/management-schema.xml
+++ b/qpid/specs/management-schema.xml
@@ -122,6 +122,7 @@
<configElement name="durable" type="bool" access="RC"/>
<configElement name="autoDelete" type="bool" access="RC"/>
<configElement name="exclusive" type="bool" access="RC"/>
+ <configElement name="arguments" type="ftable" access="RO" desc="Arguments supplied in queue.declare"/>
<configElement name="storeRef" type="objId" access="RO" desc="Reference to persistent queue (if durable)"/>
<instElement name="msgTotalEnqueues" type="count64" unit="message" desc="Total messages enqueued"/>
@@ -180,10 +181,10 @@
===============================================================
-->
<class name="binding">
- <configElement name="exchangeRef" type="objId" access="RC" index="y" parentRef="y"/>
- <configElement name="queueRef" type="objId" access="RC" index="y"/>
- <configElement name="bindingKey" type="sstr" access="RC" index="y"/>
-<!--<configElement name="arguments" type="fieldTable" access="RC"/> -->
+ <configElement name="exchangeRef" type="objId" access="RC" index="y" parentRef="y"/>
+ <configElement name="queueRef" type="objId" access="RC" index="y"/>
+ <configElement name="bindingKey" type="sstr" access="RC" index="y"/>
+ <configElement name="arguments" type="ftable" access="RC"/>
<instElement name="msgMatched" type="count64"/>
</class>
diff --git a/qpid/specs/management-types.xml b/qpid/specs/management-types.xml
index 7d77ea98a7..b3e08a612f 100644
--- a/qpid/specs/management-types.xml
+++ b/qpid/specs/management-types.xml
@@ -32,6 +32,7 @@
<type name="float" base="FLOAT" cpp="float" encode="@.putFloat (#)" decode="# = @.getFloat ()" accessor="direct" init="0."/>
<type name="double" base="DOUBLE" cpp="double" encode="@.putDouble (#)" decode="# = @.getDouble ()" accessor="direct" init="0."/>
<type name="uuid" base="UUID" cpp="framing::Uuid" encode="#.encode (@)" decode="#.decode (@)" accessor="direct"/>
+<type name="ftable" base="FTABLE" cpp="framing::FieldTable" encode="#.encode (@)" decode="#.decode (@)" accessor="direct"/>
<type name="hilo8" base="U8" cpp="uint8_t" encode="@.putOctet (#)" decode="# = @.getOctet ()" style="wm" accessor="counter" init="0"/>
<type name="hilo16" base="U16" cpp="uint16_t" encode="@.putShort (#)" decode="# = @.getShort ()" style="wm" accessor="counter" init="0"/>