Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation |
A local queue to collect messages retrieved from a remote broker queue. More...
#include <qpid/client/LocalQueue.h>
Public Member Functions | |
LocalQueue () | |
Create a local queue. More... | |
LocalQueue (const LocalQueue &) | |
~LocalQueue () | |
LocalQueue & | operator= (const LocalQueue &) |
bool | get (Message &result, sys::Duration timeout=0) |
Wait up to timeout for the next message from the local queue. More... | |
Message | get (sys::Duration timeout=sys::TIME_INFINITE) |
Get the next message off the local queue, or wait up to the timeout for message from the broker queue. More... | |
Message | pop (sys::Duration timeout=sys::TIME_INFINITE) |
Synonym for get() More... | |
bool | empty () const |
Return true if local queue is empty. More... | |
size_t | size () const |
Number of messages on the local queue. More... | |
LocalQueue (LocalQueueImpl *) | |
QPID_CLIENT_INLINE_EXTERN bool | isValid () const |
QPID_CLIENT_INLINE_EXTERN bool | isNull () const |
QPID_CLIENT_INLINE_EXTERN | operator bool () const |
Conversion to bool supports idiom if (handle) { handle->... More... | |
QPID_CLIENT_INLINE_EXTERN bool | operator! () const |
Operator ! supports idiom if (!handle) { do_if_handle_is_null(); }. More... | |
void | swap (Handle< LocalQueueImpl > &h) |
Protected Attributes | |
Impl * | impl |
A local queue to collect messages retrieved from a remote broker queue.
Create a queue and subscribe it using the SubscriptionManager. Messages from the remote queue on the broker will be stored in the local queue until you retrieve them.
Using a Local Queue
LocalQueue local_queue; subscriptions.subscribe(local_queue, string("message_queue")); for (int i=0; i<10; i++) { Message message = local_queue.get(); std::cout << message.getData() << std::endl; }
Message message = local_queue.get();
// Specifying timeouts (TIME_SEC, TIME_MSEC, TIME_USEC, TIME_NSEC) *#include <qpid/sys/Time.h> *Message message; *local_queue.get(message, 5*sys::TIME_SEC);
Definition at line 74 of file LocalQueue.h.
qpid::client::LocalQueue::LocalQueue | ( | ) |
Create a local queue.
Subscribe the local queue to a remote broker queue with a SubscriptionManager.
LocalQueue is an alternative to implementing a MessageListener.
qpid::client::LocalQueue::LocalQueue | ( | const LocalQueue & | ) |
qpid::client::LocalQueue::~LocalQueue | ( | ) |
qpid::client::LocalQueue::LocalQueue | ( | LocalQueueImpl * | ) |
bool qpid::client::LocalQueue::empty | ( | ) | const |
Return true if local queue is empty.
bool qpid::client::LocalQueue::get | ( | Message & | result, |
sys::Duration | timeout = 0 |
||
) |
Wait up to timeout for the next message from the local queue.
result | Set to the message from the queue. |
timeout | wait up this timeout for a message to appear. |
Message qpid::client::LocalQueue::get | ( | sys::Duration | timeout = sys::TIME_INFINITE | ) |
Get the next message off the local queue, or wait up to the timeout for message from the broker queue.
timeout | wait up this timeout for a message to appear. |
ClosedException | if subscription is closed or timeout exceeded. |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
LocalQueue& qpid::client::LocalQueue::operator= | ( | const LocalQueue & | ) |
Message qpid::client::LocalQueue::pop | ( | sys::Duration | timeout = sys::TIME_INFINITE | ) |
Synonym for get()
size_t qpid::client::LocalQueue::size | ( | ) | const |
Number of messages on the local queue.
|
inlineinherited |
|
protectedinherited |