summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2014-11-22 02:54:59 +0000
committerAlan Conway <aconway@apache.org>2014-11-22 02:54:59 +0000
commit372554badd0d3ca844cb6b894bc6bdc4ac9a6aed (patch)
treecc221eb0344ebaae87e3b2b257274de2a0683924 /qpid/cpp/bindings
parent3c2d3f0aee5fdfe535ce65db2190a9297a3135b4 (diff)
downloadqpid-python-372554badd0d3ca844cb6b894bc6bdc4ac9a6aed.tar.gz
NO-JIRA: Fix qpid-cpp-benchmark to work with activemq broker.
The activemq broker appears not to respect the AMQP drain flag, so calling fetch() on an empty queue hangs. Use get() with a timeout instead to drain the queues. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1641027 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings')
-rw-r--r--qpid/cpp/bindings/qpid/python/qpid_messaging.i11
1 files changed, 11 insertions, 0 deletions
diff --git a/qpid/cpp/bindings/qpid/python/qpid_messaging.i b/qpid/cpp/bindings/qpid/python/qpid_messaging.i
index f31b734efa..513cc531ae 100644
--- a/qpid/cpp/bindings/qpid/python/qpid_messaging.i
+++ b/qpid/cpp/bindings/qpid/python/qpid_messaging.i
@@ -151,6 +151,7 @@ QPID_EXCEPTION(UnauthorizedAccess, SessionError)
%rename(_next_receiver) qpid::messaging::Session::nextReceiver;
%rename(_fetch) qpid::messaging::Receiver::fetch;
+%rename(_get) qpid::messaging::Receiver::get;
%rename(unsettled) qpid::messaging::Receiver::getUnsettled;
%rename(available) qpid::messaging::Receiver::getAvailable;
@@ -346,6 +347,16 @@ QPID_EXCEPTION(UnauthorizedAccess, SessionError)
# but C++ API uses milliseconds
return self._fetch(Duration(int(1000*timeout)))
%}
+
+ %pythoncode %{
+ def get(self, timeout=None) :
+ if timeout is None :
+ return self._get()
+ else :
+ # Python API uses timeouts in seconds,
+ # but C++ API uses milliseconds
+ return self._get(Duration(int(1000*timeout)))
+ %}
}
%extend qpid::messaging::Sender {