Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
Public Member Functions | Protected Attributes
qpid::client::LocalQueue Class Reference

A local queue to collect messages retrieved from a remote broker queue. More...

#include <qpid/client/LocalQueue.h>

List of all members.

Public Member Functions

 LocalQueue ()
 Create a local queue.
 LocalQueue (const LocalQueue &)
 ~LocalQueue ()
LocalQueueoperator= (const LocalQueue &)
bool get (Message &result, sys::Duration timeout=0)
 Wait up to timeout for the next message from the local queue.
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.
Message pop (sys::Duration timeout=sys::TIME_INFINITE)
 Synonym for get()
bool empty () const
 Return true if local queue is empty.
size_t size () const
 Number of messages on the local queue.
 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->...
QPID_CLIENT_INLINE_EXTERN bool operator! () const
 Operator ! supports idiom if (!handle) { do_if_handle_is_null(); }.
void swap (Handle< LocalQueueImpl > &h)

Protected Attributes

Impl * impl

Detailed Description

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;
 }
 

Getting Messages

Checking size

Definition at line 74 of file LocalQueue.h.


Constructor & Destructor Documentation

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 *  )

Member Function Documentation

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.

Parameters:
resultSet to the message from the queue.
timeoutwait up this timeout for a message to appear.
Returns:
true if result was set, false if queue was empty after timeout.
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.

Parameters:
timeoutwait up this timeout for a message to appear.
Returns:
message from the queue.
Exceptions:
ClosedExceptionif subscription is closed or timeout exceeded.
QPID_CLIENT_INLINE_EXTERN bool qpid::client::Handle< LocalQueueImpl >::isNull ( ) const [inline, inherited]
Returns:
true if handle is null. It is an error to call any function on a null handle.

Definition at line 46 of file Handle.h.

QPID_CLIENT_INLINE_EXTERN bool qpid::client::Handle< LocalQueueImpl >::isValid ( ) const [inline, inherited]
Returns:
true if handle is valid, i.e. not null.

Definition at line 43 of file Handle.h.

QPID_CLIENT_INLINE_EXTERN qpid::client::Handle< LocalQueueImpl >::operator bool ( ) const [inline, inherited]

Conversion to bool supports idiom if (handle) { handle->...

}

Definition at line 49 of file Handle.h.

QPID_CLIENT_INLINE_EXTERN bool qpid::client::Handle< LocalQueueImpl >::operator! ( ) const [inline, inherited]

Operator ! supports idiom if (!handle) { do_if_handle_is_null(); }.

Definition at line 52 of file Handle.h.

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.

void qpid::client::Handle< LocalQueueImpl >::swap ( Handle< LocalQueueImpl > &  h) [inline, inherited]

Definition at line 54 of file Handle.h.


Member Data Documentation

Impl* qpid::client::Handle< LocalQueueImpl >::impl [protected, inherited]

Definition at line 64 of file Handle.h.


The documentation for this class was generated from the following file:

Qpid C++ API Reference
Generated on Mon Aug 22 2011 for Qpid C++ Client API by doxygen 1.7.4