summaryrefslogtreecommitdiff
path: root/python/examples/api/spout
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples/api/spout')
-rwxr-xr-xpython/examples/api/spout4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/examples/api/spout b/python/examples/api/spout
index e4d7cfb970..6584b853fc 100755
--- a/python/examples/api/spout
+++ b/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)