Qpid Management Framework  0.24
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
qmf::engine::ResilientConnection Class Reference

#include <ResilientConnection.h>

Public Member Functions

 ResilientConnection (const ConnectionSettings &settings)
 
 ~ResilientConnection ()
 
bool isConnected () const
 
bool getEvent (ResilientConnectionEvent &event)
 
void popEvent ()
 
bool createSession (const char *name, void *sessionContext, SessionHandle &handle)
 
void destroySession (SessionHandle handle)
 
void sendMessage (SessionHandle handle, Message &message)
 
void declareQueue (SessionHandle handle, char *queue)
 
void deleteQueue (SessionHandle handle, char *queue)
 
void bind (SessionHandle handle, char *exchange, char *queue, char *key)
 
void unbind (SessionHandle handle, char *exchange, char *queue, char *key)
 
void setNotifyFd (int fd)
 
void notify ()
 

Detailed Description

ResilientConnection represents a Qpid connection that is resilient.

Upon creation, ResilientConnection attempts to establish a connection to the messaging broker. If it fails, it will continue to retry at an interval that increases over time (to a maximum interval). If an extablished connection is dropped, a reconnect will be attempted.

Constructor & Destructor Documentation

qmf::engine::ResilientConnection::ResilientConnection ( const ConnectionSettings settings)

Create a new resilient connection.

Parameters
settingsSettings that define how the connection is to be made.
delayMinMinimum delay (in seconds) between retries.
delayMaxMaximum delay (in seconds) between retries.
delayFactorFactor to multiply retry delay by after each failure.
qmf::engine::ResilientConnection::~ResilientConnection ( )

Member Function Documentation

void qmf::engine::ResilientConnection::bind ( SessionHandle  handle,
char *  exchange,
char *  queue,
char *  key 
)

Bind a queue to an exchange.

Parameters
handleThe session handle of the session to use for binding.
exchangeThe name of the exchange for binding.
queueThe name of the queue for binding.
keyThe binding key.
bool qmf::engine::ResilientConnection::createSession ( const char *  name,
void *  sessionContext,
SessionHandle handle 
)

Create a new AMQP session.

Parameters
nameUnique name for the session.
sessionContextOptional user-context value that will be provided in events pertaining to this session.
handleOutput handle to be stored and used in subsequent calls pertaining to this session.
Returns
true iff the session was successfully created.
void qmf::engine::ResilientConnection::declareQueue ( SessionHandle  handle,
char *  queue 
)

Declare an exclusive, auto-delete queue for a session.

Parameters
handleThe session handle for the owner of the queue.
queueThe name of the queue.
void qmf::engine::ResilientConnection::deleteQueue ( SessionHandle  handle,
char *  queue 
)

Delete a queue.

Parameters
handleThe session handle for the owner of the queue.
queueThe name of the queue.
void qmf::engine::ResilientConnection::destroySession ( SessionHandle  handle)

Destroy a created session.

Parameters
handleSessionHandle returned by createSession.
bool qmf::engine::ResilientConnection::getEvent ( ResilientConnectionEvent event)

Get the next event (if present) from the connection.

Parameters
eventReturned event if one is available.
Returns
true if event is valid, false if there are no more events to handle.
bool qmf::engine::ResilientConnection::isConnected ( ) const

Get the connected status of the resilient connection.

Returns
true iff the connection is established.
void qmf::engine::ResilientConnection::notify ( )

Send a byte into the notify file descriptor.

This can be used to wake up the event processing portion of the engine from either the wrapped implementation or the engine itself.

void qmf::engine::ResilientConnection::popEvent ( )

Discard the event on the front of the queue. This should be invoked after processing the event from getEvent.

void qmf::engine::ResilientConnection::sendMessage ( SessionHandle  handle,
Message message 
)

Send a message into the AMQP broker via a session.

Parameters
handleThe session handle of the session to transmit through.
messageThe QMF message to transmit.
void qmf::engine::ResilientConnection::setNotifyFd ( int  fd)

Establish a file descriptor for event notification.

Parameters
fdA file descriptor into which the connection shall write a character each time an event is enqueued. This fd may be in a pair, the other fd of which is used in a select loop to control execution.
void qmf::engine::ResilientConnection::unbind ( SessionHandle  handle,
char *  exchange,
char *  queue,
char *  key 
)

Remove a binding.

Parameters
handleThe session handle of the session to use for un-binding.
exchangeThe name of the exchange.
queueThe name of the queue.
keyThe binding key.

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