summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2011-02-14 20:07:59 +0000
committerAlan Conway <aconway@apache.org>2011-02-14 20:07:59 +0000
commit87381a0bae2b890688db1597d2d6a144935498a0 (patch)
tree6c9cdd315c22818750e9ea60192c2224783335e3
parent714e190934cf8fca0ddfd378319f6dea2eca89ac (diff)
downloadqpid-python-87381a0bae2b890688db1597d2d6a144935498a0.tar.gz
No JIRA: Added --durable option to qpid-cp-benchmark
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1070634 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xcpp/src/tests/qpid-cpp-benchmark17
1 files changed, 11 insertions, 6 deletions
diff --git a/cpp/src/tests/qpid-cpp-benchmark b/cpp/src/tests/qpid-cpp-benchmark
index e865a49813..1f77226b4d 100755
--- a/cpp/src/tests/qpid-cpp-benchmark
+++ b/cpp/src/tests/qpid-cpp-benchmark
@@ -65,6 +65,8 @@ op.add_option("--connection-options", type="str",
help="Connection options for senders & receivers")
op.add_option("--flow-control", default=0, type="int", metavar="N",
help="Flow control each sender to limit queue depth to 2*N. 0 means no flow control.")
+op.add_option("--durable", default=False, action="store_true",
+ help="Use durable queues and messages")
single_quote_re = re.compile("'")
def posix_quote(string):
@@ -76,7 +78,9 @@ def ssh_command(host, command):
return ["ssh", host] + [posix_quote(arg) for arg in command]
def start_receive(queue, index, opts, ready_queue, broker, host):
- address="%s;{%s}"%(queue,",".join(["create:always"]+opts.receive_option))
+ address_opts=["create:receiver"] + opts.receive_option
+ if opts.durable: address_opts += ["node:{durable:true}"]
+ address="%s;{%s}"%(queue,",".join(address_opts))
msg_total=opts.senders*opts.messages
messages = msg_total/opts.receivers;
if (index < msg_total%opts.receivers): messages += 1
@@ -111,7 +115,8 @@ def start_send(queue, opts, broker, host):
"--report-header=no",
"--timestamp=%s"%(opts.timestamp and "yes" or "no"),
"--sequence=no",
- "--flow-control", str(opts.flow_control)
+ "--flow-control", str(opts.flow_control),
+ "--durable", str(opts.durable)
]
command += opts.send_arg
if opts.connection_options:
@@ -140,12 +145,12 @@ def print_header(timestamp):
def parse(parser, lines): # Parse sender/receiver output
for l in lines:
fn_val = zip(parser, l)
-
+
return [map(lambda p: p[0](p[1]), zip(parser,line.split())) for line in lines]
def parse_senders(senders):
return parse([int],[first_line(p) for p in senders])
-
+
def parse_receivers(receivers):
return parse([int,float,float,float],[first_line(p) for p in receivers if p])
@@ -168,7 +173,7 @@ def print_summary(send_stats, recv_stats):
l_avg = sum(l[3] for l in recv_stats)/len(recv_stats)
summary += "\t%.2f\t%.2f\t%.2f"%(l_min, l_max, l_avg)
print summary
-
+
class ReadyReceiver:
"""A receiver for ready messages"""
@@ -177,7 +182,7 @@ class ReadyReceiver:
self.connection = qpid.messaging.Connection(broker)
self.connection.open()
self.receiver = self.connection.session().receiver(
- "%s;{create:always,delete:always}"%(queue))
+ "%s;{create:receiver,delete:receiver,node:{durable:false}}"%(queue))
self.receiver.session.sync()
self.timeout=2