Drizzled Public API Documentation

drizzle_plugin::RabbitMQHandler Class Reference

wrapper around librabbitmq, hides error handling and reconnections etc TODO: add reconnection handling More...

#include <rabbitmq_handler.h>

List of all members.

Public Member Functions

 RabbitMQHandler (const std::string &hostname, const in_port_t port, const std::string &username, const std::string &password, const std::string &virtualhost) throw (rabbitmq_handler_exception)
 Constructs a new RabbitMQHandler, purpose is to hide away the error handling, reconnections etc.
void publish (void *message, const int length, const std::string &exchangeName, const std::string &routingKey) throw (rabbitmq_handler_exception)
 Publishes the message to the server.

Private Member Functions

void handleAMQPError (amqp_rpc_reply_t x, std::string context) throw (rabbitmq_handler_exception)
 Handles errors produced by librabbitmq.

Private Attributes

amqp_connection_state_t rabbitmqConnection
int sockfd
const std::string & hostname
const in_port_t port
const std::string & username
const std::string & password
const std::string & virtualhost

Detailed Description

wrapper around librabbitmq, hides error handling and reconnections etc TODO: add reconnection handling

Definition at line 58 of file rabbitmq_handler.h.


Constructor & Destructor Documentation

drizzle_plugin::RabbitMQHandler::RabbitMQHandler ( const std::string &  hostname,
const in_port_t  port,
const std::string &  username,
const std::string &  password,
const std::string &  virtualhost 
) throw (rabbitmq_handler_exception)

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]hostnamethe host to connect to.
[in]portthe port.
[in]usernamethe username to use when logging in.
[in]passwordthe password to use.
[in]virtualhostthe rabbitmq virtual host.
Exceptions:
exceptionif we cannot connect to rabbitmq server

Definition at line 36 of file rabbitmq_handler.cc.


Member Function Documentation

void drizzle_plugin::RabbitMQHandler::handleAMQPError ( amqp_rpc_reply_t  x,
std::string  context 
) throw (rabbitmq_handler_exception) [private]

Handles errors produced by librabbitmq.

If an error occurs, an error string is thrown.

Parameters:
[in]xthe response from librabbitmq
[in]contextthe context the call occured, simply appended to the error message.
Exceptions:
exceptionwith the message unless the command was successful

Definition at line 112 of file rabbitmq_handler.cc.

void drizzle_plugin::RabbitMQHandler::publish ( void *  message,
const int  length,
const std::string &  exchangeName,
const std::string &  routingKey 
) throw (rabbitmq_handler_exception)

Publishes the message to the server.

publishes the given message

Parameters:
[in]messagethe message to send
[in]lengththe length of the message
[in]exchangeNamename of the exchange to publish to
[in]routingKeythe routing key to use
Exceptions:
exceptionif there is a problem publishing

Definition at line 88 of file rabbitmq_handler.cc.

Referenced by drizzle_plugin::RabbitMQLog::apply().


Member Data Documentation

the socket file desc to the rabbitmq server, need this to be able to close() it.

Definition at line 62 of file rabbitmq_handler.h.


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