qmf::engine::ResilientConnection Class Reference

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
qmf::engine::ResilientConnection Class Reference

ResilientConnection represents a Qpid connection that is resilient. More...

`#include <qmf/engine/ResilientConnection.h>`

List of all members.

## Public Member Functions
| ResilientConnection (const ConnectionSettings &settings)
| Create a new resilient connection.
| ~ResilientConnection ()
bool | isConnected () const
| Get the connected status of the resilient connection.
bool | getEvent (ResilientConnectionEvent &event)
| Get the next event (if present) from the connection.
void | popEvent ()
| Discard the event on the front of the queue.
bool | createSession (const char *name, void *sessionContext, SessionHandle &handle)
| Create a new AMQP session.
void | destroySession (SessionHandle handle)
| Destroy a created session.
void | sendMessage (SessionHandle handle, Message &message)
| Send a message into the AMQP broker via a session.
void | declareQueue (SessionHandle handle, char *queue)
| Declare an exclusive, auto-delete queue for a session.
void | deleteQueue (SessionHandle handle, char *queue)
| Delete a queue.
void | bind (SessionHandle handle, char *exchange, char *queue, char *key)
| Bind a queue to an exchange.
void | unbind (SessionHandle handle, char *exchange, char *queue, char *key)
| Remove a binding.
void | setNotifyFd (int fd)
| Establish a file descriptor for event notification.
void | notify ()
| Send a byte into the notify file descriptor.

## 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:

  settings | Settings that define how the connection is to be made.
  delayMin | Minimum delay (in seconds) between retries.
  delayMax | Maximum delay (in seconds) between retries.
  delayFactor | Factor 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:

  handle | The session handle of the session to use for binding.
  exchange | The name of the exchange for binding.
  queue | The name of the queue for binding.
  key | The binding key.

bool qmf::engine::ResilientConnection::createSession | ( | const char * | name,
|  | void * | sessionContext,
|  | SessionHandle & | handle
| ) |  |

Create a new AMQP session.

Parameters:

  name | Unique name for the session.
  sessionContext | Optional user-context value that will be provided in events pertaining to this session.
  handle | Output 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:

  handle | The session handle for the owner of the queue.
  queue | The name of the queue.

void qmf::engine::ResilientConnection::deleteQueue | ( | SessionHandle | handle,
|  | char * | queue
| ) |  |

Delete a queue.

Parameters:

  handle | The session handle for the owner of the queue.
  queue | The name of the queue.

void qmf::engine::ResilientConnection::destroySession | ( | SessionHandle | handle | ) |

Destroy a created session.

Parameters:

  handle | SessionHandle returned by createSession.

bool qmf::engine::ResilientConnection::getEvent | ( | ResilientConnectionEvent & | event | ) |

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

Parameters:

  event | Returned 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:

  handle | The session handle of the session to transmit through.
  message | The QMF message to transmit.

void qmf::engine::ResilientConnection::setNotifyFd | ( | int | fd | ) |

Establish a file descriptor for event notification.

Parameters:

  fd | A 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:

  handle | The session handle of the session to use for un-binding.
  exchange | The name of the exchange.
  queue | The name of the queue.
  key | The binding key.

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

- qmf/engine/ResilientConnection.h