summaryrefslogtreecommitdiff
path: root/qpid/python/examples/api/spout
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2013-09-11 21:13:06 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2013-09-11 21:13:06 +0000
commit22b2a9a49eff4901fae0ef4987559aec59b4f683 (patch)
tree4d6e9f8340f5b9fab1cba746170b35c0b1e63a59 /qpid/python/examples/api/spout
parent4fe2d26d1ab8343a8bde3707fd2676fd6f6f5c98 (diff)
downloadqpid-python-22b2a9a49eff4901fae0ef4987559aec59b4f683.tar.gz
QPID-5133: Add option to the spout examples to enable durable messages
Each of the examples (C++, Ruby, Perl, Python) now have a command line option to set the durable flag on messages sent. This allows for experimenting with message persistence. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1522042 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/examples/api/spout')
-rwxr-xr-xqpid/python/examples/api/spout4
1 files changed, 4 insertions, 0 deletions
diff --git a/qpid/python/examples/api/spout b/qpid/python/examples/api/spout
index e4d7cfb970..6584b853fc 100755
--- a/qpid/python/examples/api/spout
+++ b/qpid/python/examples/api/spout
@@ -45,6 +45,8 @@ parser.add_option("-l", "--reconnect-limit", type="int",
help="maximum number of reconnect attempts")
parser.add_option("-c", "--count", type="int", default=1,
help="stop after count messages have been sent, zero disables (default %default)")
+parser.add_option("-d", "--durable", action="store_true",
+ help="make the message persistent")
parser.add_option("-t", "--timeout", type="float", default=None,
help="exit after the specified time")
parser.add_option("-I", "--id", help="use the supplied id instead of generating one")
@@ -111,6 +113,8 @@ try:
msg = Message(subject=opts.subject,
reply_to=opts.reply_to,
content=content)
+ if opts.durable:
+ msg.durable = True
if content_type is not None:
msg.content_type = content_type
msg.properties["spout-id"] = "%s:%s" % (spout_id, count)