qpid::client::SubscriptionManager Class Reference
[Application API for an AMQP client.]

A class to help create and manage subscriptions. More...

#include <SubscriptionManager.h>

Inheritance diagram for qpid::client::SubscriptionManager:

Inheritance graph
[legend]
Collaboration diagram for qpid::client::SubscriptionManager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SubscriptionManager (const Session &session)
 Create a new SubscriptionManager associated with a session.
void subscribe (MessageListener &listener, const std::string &queue, const FlowControl &flow, const std::string &tag=std::string())
 Subscribe a MessagesListener to receive messages from queue.
void subscribe (LocalQueue &localQueue, const std::string &queue, const FlowControl &flow, const std::string &tag=std::string())
 Subscribe a LocalQueue to receive messages from queue.
void subscribe (MessageListener &listener, const std::string &queue, const std::string &tag=std::string())
 Subscribe a MessagesListener to receive messages from queue.
void subscribe (LocalQueue &localQueue, const std::string &queue, const std::string &tag=std::string())
 Subscribe a LocalQueue to receive messages from queue.
bool get (Message &result, const std::string &queue, sys::Duration timeout=0)
 Get a single message from a queue.
void cancel (const std::string tag)
 Cancel a subscription.
void run ()
 Deliver messages in the current thread until stop() is called.
void start ()
 Start a new thread to deliver messages.
void setAutoStop (bool set=true)
 If set true, run() will stop when all subscriptions are cancelled.
void stop ()
 Stop delivery.
void setFlowControl (const std::string &destintion, const FlowControl &flow)
 Set the flow control for destination.
void setFlowControl (const FlowControl &flow)
 Set the default initial flow control for subscriptions that do not specify it.
const FlowControlgetFlowControl () const
 Get the default flow control for new subscriptions that do not specify it.
void setFlowControl (const std::string &tag, uint32_t messages, uint32_t bytes, bool window=true)
 Set the flow control for destination tag.
void setFlowControl (uint32_t messages, uint32_t bytes, bool window=true)
 Set the initial flow control settings to be applied to each new subscribtion.
void setAcceptMode (bool required)
 Set the accept-mode for new subscriptions.
void setAcquireMode (bool acquire)
 Set the acquire-mode for new subscriptions.
void setAckPolicy (const AckPolicy &autoAck)
 Set the acknowledgement policy for new subscriptions.
AckPolicygetAckPolicy ()
void registerFailoverHandler (boost::function< void()> fh)
Session getSession () const

Static Public Attributes

static const uint32_t UNLIMITED = 0xFFFFFFFF


Detailed Description

A class to help create and manage subscriptions.

Set up your subscriptions, then call run() to have messages delivered.

Definition at line 46 of file SubscriptionManager.h.


Member Function Documentation

void qpid::client::SubscriptionManager::subscribe ( MessageListener listener,
const std::string &  queue,
const FlowControl flow,
const std::string &  tag = std::string() 
)

Subscribe a MessagesListener to receive messages from queue.

Provide your own subclass of MessagesListener to process incoming messages. It will be called for each message received.

Parameters:
listener Listener object to receive messages.
queue Name of the queue to subscribe to.
flow initial FlowControl for the subscription.
tag Unique destination tag for the listener. If not specified, the queue name is used.

void qpid::client::SubscriptionManager::subscribe ( LocalQueue localQueue,
const std::string &  queue,
const FlowControl flow,
const std::string &  tag = std::string() 
)

Subscribe a LocalQueue to receive messages from queue.

Incoming messages are stored in the queue for you to retrieve.

Parameters:
queue Name of the queue to subscribe to.
flow initial FlowControl for the subscription.
tag Unique destination tag for the listener. If not specified, the queue name is used.

void qpid::client::SubscriptionManager::subscribe ( MessageListener listener,
const std::string &  queue,
const std::string &  tag = std::string() 
)

Subscribe a MessagesListener to receive messages from queue.

Provide your own subclass of MessagesListener to process incoming messages. It will be called for each message received.

Parameters:
listener Listener object to receive messages.
queue Name of the queue to subscribe to.
tag Unique destination tag for the listener. If not specified, the queue name is used.

void qpid::client::SubscriptionManager::subscribe ( LocalQueue localQueue,
const std::string &  queue,
const std::string &  tag = std::string() 
)

Subscribe a LocalQueue to receive messages from queue.

Incoming messages are stored in the queue for you to retrieve.

Parameters:
queue Name of the queue to subscribe to.
tag Unique destination tag for the listener. If not specified, the queue name is used.

bool qpid::client::SubscriptionManager::get ( Message result,
const std::string &  queue,
sys::Duration  timeout = 0 
)

Get a single message from a queue.

Parameters:
result is set to the message from the queue. @
timeout wait up this timeout for a message to appear.
Returns:
true if result was set, false if no message available after timeout.

void qpid::client::SubscriptionManager::cancel ( const std::string  tag  ) 

Cancel a subscription.

void qpid::client::SubscriptionManager::run (  )  [virtual]

Deliver messages in the current thread until stop() is called.

Only one thread may be running in a SubscriptionManager at a time.

See also:
run

Implements qpid::sys::Runnable.

void qpid::client::SubscriptionManager::start (  ) 

Start a new thread to deliver messages.

Only one thread may be running in a SubscriptionManager at a time.

See also:
start

void qpid::client::SubscriptionManager::setAutoStop ( bool  set = true  ) 

If set true, run() will stop when all subscriptions are cancelled.

If false, run will only stop when stop() is called. True by default.

void qpid::client::SubscriptionManager::stop (  ) 

Stop delivery.

Causes run() to return, or the thread started with start() to exit.

void qpid::client::SubscriptionManager::setFlowControl ( const std::string &  destintion,
const FlowControl flow 
)

Set the flow control for destination.

void qpid::client::SubscriptionManager::setFlowControl ( const FlowControl flow  ) 

Set the default initial flow control for subscriptions that do not specify it.

const FlowControl& qpid::client::SubscriptionManager::getFlowControl (  )  const

Get the default flow control for new subscriptions that do not specify it.

void qpid::client::SubscriptionManager::setFlowControl ( const std::string &  tag,
uint32_t  messages,
uint32_t  bytes,
bool  window = true 
)

Set the flow control for destination tag.

Parameters:
tag,: name of the destination.
messages,: message credit.
bytes,: byte credit.
window,: if true use window-based flow control.

void qpid::client::SubscriptionManager::setFlowControl ( uint32_t  messages,
uint32_t  bytes,
bool  window = true 
)

Set the initial flow control settings to be applied to each new subscribtion.

Parameters:
messages,: message credit.
bytes,: byte credit.
window,: if true use window-based flow control.

void qpid::client::SubscriptionManager::setAcceptMode ( bool  required  ) 

Set the accept-mode for new subscriptions.

Defaults to true.

Parameters:
required,: if true messages must be confirmed by calling Message::acknowledge() or automatically, see setAckPolicy()

void qpid::client::SubscriptionManager::setAcquireMode ( bool  acquire  ) 

Set the acquire-mode for new subscriptions.

Defaults to false.

Parameters:
acquire,: if false messages pre-acquired, if true messages are dequed on acknowledgement or on transfer depending on acceptMode.

void qpid::client::SubscriptionManager::setAckPolicy ( const AckPolicy autoAck  ) 

Set the acknowledgement policy for new subscriptions.

Default is to acknowledge every message automatically.


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

Generated on Thu Oct 16 13:38:21 2008 for Qpid by  doxygen 1.5.6