diff options
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/broker/Vhost.cpp | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/client/LocalQueue.h | 6 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SubscriptionManager.cpp | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SubscriptionManager.h | 8 |
4 files changed, 21 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/Vhost.cpp b/cpp/src/qpid/broker/Vhost.cpp index 537d2b4e29..c5bb6c5104 100644 --- a/cpp/src/qpid/broker/Vhost.cpp +++ b/cpp/src/qpid/broker/Vhost.cpp @@ -24,7 +24,9 @@ using namespace qpid::broker; using qpid::management::ManagementAgent; namespace _qmf = qmf::org::apache::qpid::broker; -class qpid::management::Manageable; +namespace qpid { namespace management { +class Manageable; +}} Vhost::Vhost (qpid::management::Manageable* parentBroker) : mgmtObject(0) { diff --git a/cpp/src/qpid/client/LocalQueue.h b/cpp/src/qpid/client/LocalQueue.h index 3be2293810..2b878b2939 100644 --- a/cpp/src/qpid/client/LocalQueue.h +++ b/cpp/src/qpid/client/LocalQueue.h @@ -58,11 +58,13 @@ class LocalQueue { /** Get the next message off the local queue, or wait up to the timeout * for message from the broker queue. - *@exception ClosedException if subscription is closed or timeout exceeded. + *@param timeout wait up this timeout for a message to appear. + *@return message from the queue. + *@throw ClosedException if subscription is closed or timeout exceeded. */ Message get(sys::Duration timeout=sys::TIME_INFINITE); - /** Synonym for get(). */ + /** Synonym for get() */ Message pop(sys::Duration timeout=sys::TIME_INFINITE); /** Return true if local queue is empty. */ diff --git a/cpp/src/qpid/client/SubscriptionManager.cpp b/cpp/src/qpid/client/SubscriptionManager.cpp index 350fd86aa6..6fa1973b9d 100644 --- a/cpp/src/qpid/client/SubscriptionManager.cpp +++ b/cpp/src/qpid/client/SubscriptionManager.cpp @@ -107,6 +107,13 @@ bool SubscriptionManager::get(Message& result, const std::string& queue, sys::Du return lq.get(result, 0); } +Message SubscriptionManager::get(const std::string& queue, sys::Duration timeout) { + Message result; + if (!get(result, queue, timeout)) + throw Exception("Timed out waiting for a message"); + return result; +} + Session SubscriptionManager::getSession() const { return session; } Subscription SubscriptionManager::getSubscription(const std::string& name) const { diff --git a/cpp/src/qpid/client/SubscriptionManager.h b/cpp/src/qpid/client/SubscriptionManager.h index 46394808f4..393349a6af 100644 --- a/cpp/src/qpid/client/SubscriptionManager.h +++ b/cpp/src/qpid/client/SubscriptionManager.h @@ -120,12 +120,18 @@ class SubscriptionManager : public sys::Runnable /** Get a single message from a queue. *@param result is set to the message from the queue. - *@ *@param timeout wait up this timeout for a message to appear. *@return true if result was set, false if no message available after timeout. */ bool get(Message& result, const std::string& queue, sys::Duration timeout=0); + /** Get a single message from a queue. + *@param timeout wait up this timeout for a message to appear. + *@return message from the queue. + *@throw Exception if the timeout is exceeded. + */ + Message get(const std::string& queue, sys::Duration timeout=sys::TIME_INFINITE); + /** Get a subscription by name. *@throw Exception if not found. */ |
