summaryrefslogtreecommitdiff
path: root/tools/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-03-05 21:31:58 +0000
committerAlan Conway <aconway@apache.org>2012-03-05 21:31:58 +0000
commit61eeb68cc7b14382aface77cc8c76f7e8cc2b4c3 (patch)
tree344025a92443736c33815155ee0dc54fbfab6fa3 /tools/src
parentedbd969df9b013e534b496a10324b00e83d53f02 (diff)
downloadqpid-python-61eeb68cc7b14382aface77cc8c76f7e8cc2b4c3.tar.gz
QPID-3603: Initial documentation for the new HA plug-in.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1297234 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools/src')
-rwxr-xr-xtools/src/py/qpid-config43
-rwxr-xr-xtools/src/py/qpid-ha10
2 files changed, 27 insertions, 26 deletions
diff --git a/tools/src/py/qpid-config b/tools/src/py/qpid-config
index fb0f34f72e..896ae89faf 100755
--- a/tools/src/py/qpid-config
+++ b/tools/src/py/qpid-config
@@ -74,10 +74,10 @@ Replication levels:
none - no replication
configuration - replicate queue and exchange existence and bindings, but not messages.
- messages - replicate configuration and messages
+ all - replicate configuration and messages
"""
-REPLICATION_LEVELS= ["none", "configuration", "messages"]
+REPLICATE_LEVELS= ["none", "configuration", "all"]
class Config:
def __init__(self):
@@ -87,7 +87,7 @@ class Config:
self._ignoreDefault = False
self._altern_ex = None
self._durable = False
- self._replication = None
+ self._replicate = None
self._ha_admin = False
self._clusterDurable = False
self._if_empty = True
@@ -110,7 +110,7 @@ class Config:
self._msgGroupHeader = None
self._sharedMsgGroup = False
self._extra_arguments = []
- self._replicate_from = None
+ self._start_replica = None
self._returnCode = 0
config = Config()
@@ -131,7 +131,7 @@ FLOW_STOP_SIZE = "qpid.flow_stop_size"
FLOW_RESUME_SIZE = "qpid.flow_resume_size"
MSG_GROUP_HDR_KEY = "qpid.group_header_key"
SHARED_MSG_GROUP = "qpid.shared_msg_group"
-REPLICATION = "qpid.replicate"
+REPLICATE = "qpid.replicate"
#There are various arguments to declare that have specific program
#options in this utility. However there is now a generic mechanism for
#passing arguments as well. The SPECIAL_ARGS list contains the
@@ -142,7 +142,7 @@ SPECIAL_ARGS=[
FILECOUNT,FILESIZE,MAX_QUEUE_SIZE,MAX_QUEUE_COUNT,POLICY_TYPE,CLUSTER_DURABLE,
LVQ_KEY,MSG_SEQUENCE,IVE,QUEUE_EVENT_GENERATION,
FLOW_STOP_COUNT,FLOW_STOP_SIZE,FLOW_RESUME_SIZE,
- MSG_GROUP_HDR_KEY,SHARED_MSG_GROUP,REPLICATION]
+ MSG_GROUP_HDR_KEY,SHARED_MSG_GROUP,REPLICATE]
class JHelpFormatter(IndentedHelpFormatter):
"""Format usage and description without stripping newlines from usage strings
@@ -186,7 +186,7 @@ def OptionsAndArguments(argv):
group2 = OptionGroup(parser, "Options for Adding Exchanges and Queues")
group2.add_option("--alternate-exchange", action="store", type="string", metavar="<aexname>", help="Name of the alternate-exchange for the new queue or exchange. Exchanges route messages to the alternate exchange if they are unable to route them elsewhere. Queues route messages to the alternate exchange if they are rejected by a subscriber or orphaned by queue deletion.")
group2.add_option("--durable", action="store_true", help="The new queue or exchange is durable.")
- group2.add_option("--replication", action="store", metavar="<level>", help="Enable automatic replication in a HA cluster. <level> is 'none', 'configuration' or 'messages').")
+ group2.add_option("--replicate", action="store", metavar="<level>", help="Enable automatic replication in a HA cluster. <level> is 'none', 'configuration' or 'all').")
group2.add_option("--ha-admin", action="store_true", help="Allow connection to a HA backup broker.")
parser.add_option_group(group2)
@@ -213,7 +213,7 @@ def OptionsAndArguments(argv):
help="Allow message group consumption across multiple consumers.")
group3.add_option("--argument", dest="extra_arguments", action="append", default=[],
metavar="<NAME=VALUE>", help="Specify a key-value pair to add to queue arguments")
- group3.add_option("--replicate-from", metavar="<broker-url>", help="Replicate from the same-named queue at <broker-url>")
+ group3.add_option("--start-replica", metavar="<broker-url>", help="Start replication from the same-named queue at <broker-url>")
# no option for declaring an exclusive queue - which can only be used by the session that creates it.
parser.add_option_group(group3)
@@ -254,10 +254,10 @@ def OptionsAndArguments(argv):
config._altern_ex = opts.alternate_exchange
if opts.durable:
config._durable = True
- if opts.replication:
- if not opts.replication in REPLICATION_LEVELS:
- raise Exception("Invalid replication level '%s', should be one of: %s" % (opts.replication, ", ".join(REPLICATION_LEVELS)))
- config._replication = opts.replication
+ if opts.replicate:
+ if not opts.replicate in REPLICATE_LEVELS:
+ raise Exception("Invalid replication level '%s', should be one of: %s" % (opts.replicate, ", ".join(REPLICATE_LEVELS)))
+ config._replicate = opts.replicate
if opts.ha_admin: config._ha_admin = True
if opts.cluster_durable:
config._clusterDurable = True
@@ -304,8 +304,8 @@ def OptionsAndArguments(argv):
config._sharedMsgGroup = True
if opts.extra_arguments:
config._extra_arguments = opts.extra_arguments
- if opts.replicate_from:
- config._replicate_from = opts.replicate_from
+ if opts.start_replica:
+ config._start_replica = opts.start_replica
return args
@@ -416,6 +416,7 @@ class BrokerManager:
args = ex.arguments
if not args: args = {}
if ex.durable: print "--durable",
+ if REPLICATE in args: print "--replicate=%s" % args[REPLICATE],
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:
@@ -468,7 +469,7 @@ class BrokerManager:
args = q.arguments
if not args: args = {}
if q.durable: print "--durable",
- if REPLICATION in args: print "--replication=%s" % args[REPLICATION],
+ if REPLICATE in args: print "--replicate=%s" % args[REPLICATE],
if CLUSTER_DURABLE in args and args[CLUSTER_DURABLE] == 1: print "--cluster-durable",
if q.autoDelete: print "auto-del",
if q.exclusive: print "excl",
@@ -530,8 +531,8 @@ class BrokerManager:
declArgs['alternate-exchange'] = config._altern_ex
if config._durable:
declArgs['durable'] = 1
- if config._replication:
- declArgs[REPLICATION] = config._replication
+ if config._replicate:
+ declArgs[REPLICATE] = config._replicate
self.broker.addExchange(etype, ename, declArgs)
@@ -598,11 +599,11 @@ class BrokerManager:
declArgs['alternate-exchange'] = config._altern_ex
if config._durable:
declArgs['durable'] = 1
- if config._replication:
- declArgs[REPLICATION] = config._replication
+ if config._replicate:
+ declArgs[REPLICATE] = config._replicate
self.broker.addQueue(qname, declArgs)
- if config._replicate_from: # Start replication
- self.broker._method("replicate", {"broker":config._replicate_from, "queue":qname}, "org.apache.qpid.ha:habroker:ha-broker")
+ if config._start_replica: # Start replication
+ self.broker._method("replicate", {"broker":config._start_replica, "queue":qname}, "org.apache.qpid.ha:habroker:ha-broker")
def DelQueue(self, args):
if len(args) < 1:
diff --git a/tools/src/py/qpid-ha b/tools/src/py/qpid-ha
index 029ecd0c41..5c757f3c6c 100755
--- a/tools/src/py/qpid-ha
+++ b/tools/src/py/qpid-ha
@@ -19,7 +19,7 @@
# under the License.
#
-import qmf.console, optparse, sys, time
+import qmf.console, optparse, sys, time, os
from qpid.management import managementChannel, managementClient
from qpid.messaging import Connection
from qpid.messaging import Message as QpidMessage
@@ -125,12 +125,12 @@ class QueryCmd(Command):
print "%-20s %s"%(x[0], x[1])
QueryCmd()
-def print_usage(name):
- print "usage: %s <command> [<arguments>]\n\nCommands are:\n"%name
+def print_usage(prog):
+ print "usage: %s <command> [<arguments>]\n\nCommands are:\n"%prog
for name, command in Command.commands.iteritems():
help = command.help
print " %-12s %s."%(name, help.split(".")[0])
- print "\nFor help with a command: %s <command> --help\n"%name
+ print "\nFor help with a command type: %s <command> --help\n"%prog
def find_command(args):
"""Find a command among the arguments and options"""
@@ -148,7 +148,7 @@ def main(argv):
return 1
command = find_command(args)
if not command:
- print_usage(argv[0]);
+ print_usage(os.path.basename(argv[0]));
return 1;
if command.execute(): return 1
except Exception, e: