wrapper around librabbitmq, hides error handling and reconnections etc TODO: add reconnection handling
More...
#include <rabbitmq_handler.h>
|
| | RabbitMQHandler (const std::string &hostname, const in_port_t port, const std::string &username, const std::string &password, const std::string &virtualhost, const std::string &exchange, const std::string &routingKey) |
| | Constructs a new RabbitMQHandler, purpose is to hide away the error handling, reconnections etc.
|
| void | publish (void *message, const int length) |
| | Publishes the message to the server.
|
| void | reconnect () |
| void | disconnect () |
| void | connect () |
|
| void | handleAMQPError (amqp_rpc_reply_t x, std::string context) |
| | Handles errors produced by librabbitmq.
|
wrapper around librabbitmq, hides error handling and reconnections etc TODO: add reconnection handling
Definition at line 59 of file rabbitmq_handler.h.
◆ RabbitMQHandler()
| drizzle_plugin::rabbitmq::RabbitMQHandler::RabbitMQHandler |
( |
const std::string & | hostname, |
|
|
const in_port_t | port, |
|
|
const std::string & | username, |
|
|
const std::string & | password, |
|
|
const std::string & | virtualhost, |
|
|
const std::string & | exchange, |
|
|
const std::string & | routingKey ) |
Constructs a new RabbitMQHandler, purpose is to hide away the error handling, reconnections etc.
Connects to the given rabbitmq server on the virtualhost with the given username/password.
- Parameters
-
| [in] | hostname | the host to connect to. |
| [in] | port | the port. |
| [in] | username | the username to use when logging in. |
| [in] | password | the password to use. |
| [in] | virtualhost | the rabbitmq virtual host. |
- Exceptions
-
| exception | if we cannot connect to rabbitmq server |
Definition at line 42 of file rabbitmq_handler.cc.
◆ ~RabbitMQHandler()
| drizzle_plugin::rabbitmq::RabbitMQHandler::~RabbitMQHandler |
( |
| ) |
|
◆ connect()
| void drizzle_plugin::rabbitmq::RabbitMQHandler::connect |
( |
| ) |
|
◆ disconnect()
| void drizzle_plugin::rabbitmq::RabbitMQHandler::disconnect |
( |
| ) |
|
◆ handleAMQPError()
| void drizzle_plugin::rabbitmq::RabbitMQHandler::handleAMQPError |
( |
amqp_rpc_reply_t | x, |
|
|
std::string | context ) |
|
private |
Handles errors produced by librabbitmq.
If an error occurs, an error string is thrown.
- Parameters
-
| [in] | x | the response from librabbitmq |
| [in] | context | the context the call occured, simply appended to the error message. |
- Exceptions
-
| exception | with the message unless the command was successful |
Definition at line 157 of file rabbitmq_handler.cc.
◆ publish()
| void drizzle_plugin::rabbitmq::RabbitMQHandler::publish |
( |
void * | message, |
|
|
const int | length ) |
Publishes the message to the server.
publishes the given message
- Parameters
-
| [in] | message | the message to send |
| [in] | length | the length of the message |
- Exceptions
-
| exception | if there is a problem publishing |
Definition at line 69 of file rabbitmq_handler.cc.
◆ reconnect()
| void drizzle_plugin::rabbitmq::RabbitMQHandler::reconnect |
( |
| ) |
|
◆ exchange
| const std::string& drizzle_plugin::rabbitmq::RabbitMQHandler::exchange |
|
private |
◆ hostname
| const std::string& drizzle_plugin::rabbitmq::RabbitMQHandler::hostname |
|
private |
◆ password
| const std::string& drizzle_plugin::rabbitmq::RabbitMQHandler::password |
|
private |
◆ port
| const in_port_t drizzle_plugin::rabbitmq::RabbitMQHandler::port |
|
private |
◆ publishLock
| pthread_mutex_t drizzle_plugin::rabbitmq::RabbitMQHandler::publishLock |
|
private |
◆ rabbitmq_connection_established
| bool drizzle_plugin::rabbitmq::RabbitMQHandler::rabbitmq_connection_established |
◆ rabbitmqConnection
| amqp_connection_state_t drizzle_plugin::rabbitmq::RabbitMQHandler::rabbitmqConnection |
|
private |
◆ routingKey
| const std::string& drizzle_plugin::rabbitmq::RabbitMQHandler::routingKey |
|
private |
◆ username
| const std::string& drizzle_plugin::rabbitmq::RabbitMQHandler::username |
|
private |
◆ virtualhost
| const std::string& drizzle_plugin::rabbitmq::RabbitMQHandler::virtualhost |
|
private |
The documentation for this class was generated from the following files: