diff options
author | Rafael H. Schloming <rhs@apache.org> | 2009-10-11 05:42:24 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2009-10-11 05:42:24 +0000 |
commit | 1c2199293f985f4682afdc5450f2095d95dc0829 (patch) | |
tree | 4a4ca415fdd145fb7f88027365329288e337514a /python/qpid/messaging.py | |
parent | 110b9a660d4e64f507f51c7d9a94d4997f6584f8 (diff) | |
download | qpid-python-1c2199293f985f4682afdc5450f2095d95dc0829.tar.gz |
added durable and reconnect options to the tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@824028 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/messaging.py')
-rw-r--r-- | python/qpid/messaging.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/python/qpid/messaging.py b/python/qpid/messaging.py index 1d548a3d87..3264ee050c 100644 --- a/python/qpid/messaging.py +++ b/python/qpid/messaging.py @@ -78,7 +78,7 @@ class Connection: @static def open(host, port=None, username="guest", password="guest", - mechanism="PLAIN", heartbeat=None): + mechanism="PLAIN", heartbeat=None, **options): """ Creates an AMQP connection and connects it to the given host and port. @@ -89,12 +89,12 @@ class Connection: @rtype: Connection @return: a connected Connection """ - conn = Connection(host, port, username, password, mechanism, heartbeat) + conn = Connection(host, port, username, password, mechanism, heartbeat, **options) conn.connect() return conn def __init__(self, host, port=None, username="guest", password="guest", - mechanism="PLAIN", heartbeat=None): + mechanism="PLAIN", heartbeat=None, **options): """ Creates a connection. A newly created connection must be connected with the Connection.connect() method before it can be started. @@ -117,7 +117,7 @@ class Connection: self.id = str(uuid4()) self.session_counter = 0 self.sessions = {} - self.reconnect = False + self.reconnect = options.get("reconnect", False) self._connected = False self._lock = RLock() self._condition = Condition(self._lock) @@ -524,6 +524,7 @@ class Sender: self.target = target self.options = options self.capacity = options.get("capacity", UNLIMITED) + self.durable = options.get("durable") self.queued = Serial(0) self.acked = Serial(0) self.error = None @@ -586,6 +587,9 @@ class Sender: else: message = Message(object) + if message.durable is None: + message.durable = self.durable + if self.capacity is not UNLIMITED: if self.capacity <= 0: raise InsufficientCapacity("capacity = %s" % self.capacity) @@ -851,7 +855,7 @@ class Message: self.to = None self.reply_to = None self.correlation_id = None - self.durable = False + self.durable = None self.properties = {} self.content_type = get_type(content) self.content = content |