Author: tross
Date: Fri Oct 24 08:12:53 2008
New Revision: 707651
URL: http://svn.apache.org/viewvc?rev=707651&view=rev
Log:
Added exchange options to qpid-config
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
incubator/qpid/trunk/qpid/python/commands/qpid-config
incubator/qpid/trunk/qpid/specs/management-schema.xml
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp?rev=707651&r1=707650&r2=707651&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Exchange.cpp Fri Oct 24
08:12:53 2008
@@ -105,6 +105,7 @@
if (agent != 0)
{
mgmtExchange = new _qmf::Exchange (agent, this, parent, _name,
durable);
+ mgmtExchange->set_arguments(args);
if (!durable) {
if (name == "")
agent->addObject (mgmtExchange, 0x1000000000000004LL); //
Special default exchange ID
Modified: incubator/qpid/trunk/qpid/python/commands/qpid-config
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/commands/qpid-config?rev=707651&r1=707650&r2=707651&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/commands/qpid-config (original)
+++ incubator/qpid/trunk/qpid/python/commands/qpid-config Fri Oct 24 08:12:53
2008
@@ -35,6 +35,8 @@
_policyType = None
_lvq = False
_optimisticConsume = False
+_msgSequence = False
+_ive = False
FILECOUNT = "qpid.file_count"
FILESIZE = "qpid.file_size"
@@ -44,6 +46,8 @@
CLUSTER_DURABLE = "qpid.persist_last_node"
LVQ = "qpid.last_value_queue"
OPTIMISTIC_CONSUME = "qpid.optimistic_consume"
+MSG_SEQUENCE = "qpid.msg_sequence"
+IVE = "qpid.ive"
def Usage ():
print "Usage: qpid-config [OPTIONS]"
@@ -74,7 +78,12 @@
print " --optimistic-consume Enable optimistic consume on the queue"
print
print "Add Exchange Options:"
- print " --durable Exchange is durable"
+ print " --durable Exchange is durable"
+ print " --sequence Exchange will insert a 'qpid.msg_sequence' field
in the message header"
+ print " with a value that increments for each message
forwarded."
+ print " --ive Exchange will behave as an
'initial-value-exchange', keeping a reference"
+ print " to the last message forwarded and enqueuing that
message to newly bound"
+ print " queues."
print
sys.exit (1)
@@ -116,11 +125,26 @@
def ExchangeList (self, filter):
exchanges = self.qmf.getObjects(_class="exchange")
- print "Durable Type Bindings Exchange Name"
- print "======================================================="
+ caption1 = "Type "
+ caption2 = "Exchange Name"
+ maxNameLen = len(caption2)
+ for ex in exchanges:
+ if self.match(ex.name, filter):
+ if len(ex.name) > maxNameLen: maxNameLen = len(ex.name)
+ print "%s%-*s Attributes" % (caption1, maxNameLen, caption2)
+ line = ""
+ for i in range(((maxNameLen + len(caption1)) / 5) + 5):
+ line += "====="
+ print line
+
for ex in exchanges:
if self.match (ex.name, filter):
- print "%4c %-10s%5d %s" % (YN (ex.durable), ex.type,
ex.bindingCount, ex.name)
+ print "%-10s%-*s " % (ex.type, maxNameLen, ex.name),
+ args = ex.arguments
+ 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",
+ print
def ExchangeListRecurse (self, filter):
exchanges = self.qmf.getObjects(_class="exchange")
@@ -144,7 +168,8 @@
caption = "Queue Name"
maxNameLen = len(caption)
for q in queues:
- if len(q.name) > maxNameLen: maxNameLen = len(q.name)
+ if self.match (q.name, filter):
+ if len(q.name) > maxNameLen: maxNameLen = len(q.name)
print "%-*s Attributes" % (maxNameLen, caption)
line = ""
for i in range((maxNameLen / 5) + 5):
@@ -152,20 +177,21 @@
print line
for q in queues:
- print "%-*s " % (maxNameLen, q.name),
- args = q.arguments
- if q.durable: print "durable",
- if CLUSTER_DURABLE in args and args[CLUSTER_DURABLE] == 1: print
"clusterDurable",
- if q.autoDelete: print "autoDel",
- if q.exclusive: print "excl",
- if FILESIZE in args: print "fileSize=%d" % args[FILESIZE],
- if FILECOUNT in args: print "fileCount=%d" % args[FILECOUNT],
- if MAX_QUEUE_SIZE in args: print "maxQSize=%d" %
args[MAX_QUEUE_SIZE],
- if MAX_QUEUE_COUNT in args: print "maxQCount=%d" %
args[MAX_QUEUE_COUNT],
- if POLICY_TYPE in args: print "policy=%s" % args[POLICY_TYPE],
- if LVQ in args and args[LVQ] == 1: print "lvq",
- if OPTIMISTIC_CONSUME in args and args[OPTIMISTIC_CONSUME] == 1:
print "optConsume",
- print
+ if self.match (q.name, filter):
+ print "%-*s " % (maxNameLen, q.name),
+ args = q.arguments
+ if q.durable: print "--durable",
+ if CLUSTER_DURABLE in args and args[CLUSTER_DURABLE] == 1:
print "--cluster-durable",
+ if q.autoDelete: print "auto-del",
+ if q.exclusive: print "excl",
+ if FILESIZE in args: print "--file-size=%d" % args[FILESIZE],
+ if FILECOUNT in args: print "--file-count=%d" %
args[FILECOUNT],
+ if MAX_QUEUE_SIZE in args: print "--max-queue-size=%d" %
args[MAX_QUEUE_SIZE],
+ if MAX_QUEUE_COUNT in args: print "--max-queue-count=%d" %
args[MAX_QUEUE_COUNT],
+ if POLICY_TYPE in args: print "--policy-type=%s" %
args[POLICY_TYPE],
+ if LVQ in args and args[LVQ] == 1: print "--last-value-queue",
+ if OPTIMISTIC_CONSUME in args and args[OPTIMISTIC_CONSUME] ==
1: print "--optimistic-consume",
+ print
def QueueListRecurse (self, filter):
exchanges = self.qmf.getObjects(_class="exchange")
@@ -189,7 +215,12 @@
Usage ()
etype = args[0]
ename = args[1]
- self.broker.getAmqpSession().exchange_declare (exchange=ename,
type=etype, durable=_durable)
+ declArgs = {}
+ if _msgSequence:
+ declArgs[MSG_SEQUENCE] = 1
+ if _ive:
+ declArgs[IVE] = 1
+ self.broker.getAmqpSession().exchange_declare (exchange=ename,
type=etype, durable=_durable, arguments=declArgs)
def DelExchange (self, args):
if len (args) < 1:
@@ -265,6 +296,7 @@
return 'Y'
return 'N'
+
##
## Main Program
##
@@ -272,7 +304,7 @@
try:
longOpts = ("durable", "cluster-durable", "bindings", "broker-addr=",
"file-count=",
"file-size=", "max-queue-size=", "max-queue-count=",
"policy-type=",
- "last-value-queue", "optimistic-consume")
+ "last-value-queue", "optimistic-consume", "sequence", "ive")
(optlist, cargs) = getopt.gnu_getopt (sys.argv[1:], "a:b", longOpts)
except:
Usage ()
@@ -300,6 +332,10 @@
_lvq = True
if opt[0] == "--optimistic-consume":
_optimisticConsume = True
+ if opt[0] == "--sequence":
+ _msgSequence = True
+ if opt[0] == "--ive":
+ _ive = True
nargs = len (cargs)
bm = BrokerManager ()
@@ -313,12 +349,12 @@
modifier = ""
if nargs > 1:
modifier = cargs[1]
- if cmd[0] == 'e':
+ if cmd == "exchanges":
if _recursive:
bm.ExchangeListRecurse (modifier)
else:
bm.ExchangeList (modifier)
- elif cmd[0] == 'q':
+ elif cmd == "queues":
if _recursive:
bm.QueueListRecurse (modifier)
else:
@@ -344,7 +380,6 @@
else:
Usage ()
except Exception,e:
- raise
print "Failed:", e.message
sys.exit(1)
Modified: incubator/qpid/trunk/qpid/specs/management-schema.xml
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/management-schema.xml?rev=707651&r1=707650&r2=707651&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/specs/management-schema.xml (original)
+++ incubator/qpid/trunk/qpid/specs/management-schema.xml Fri Oct 24 08:12:53
2008
@@ -175,6 +175,7 @@
<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"/>
<statistic name="producerCount" type="hilo32" desc="Current producers on
exchange"/>
<statistic name="bindingCount" type="hilo32" desc="Current bindings"/>