~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/rabbitmq/rabbitmq_log.h

  • Committer: Marcus Eriksson
  • Date: 2010-02-06 20:18:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1438.
  • Revision ID: marcuse@localhost.localdomain-20100206201839-7fh52959ox940hud
rabbitmq replication applier

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef PLUGIN_RABBITMQ_LOG_RABBITMQ_LOG_H
 
2
#define PLUGIN_RABBITMQ_LOG_RABBITMQ_LOG_H
 
3
#include <drizzled/replication_services.h>
 
4
#include <drizzled/plugin/transaction_applier.h>
 
5
#include <string>
 
6
#include "rabbitmq_handler.h"
 
7
 
 
8
 
 
9
/**
 
10
 * @brief
 
11
 *   A TransactionApplier that sends the transactions to rabbitmq
 
12
 *   (or any AMQP 0-8 compliant message queue)
 
13
 *
 
14
 * @details
 
15
 *   Connects to rabbitmq server in constructor, publishes messages
 
16
 *   in apply(...). If error occurs, the plugin disables itself.
 
17
 */
 
18
class RabbitMQLog: public drizzled::plugin::TransactionApplier 
 
19
{
 
20
private:
 
21
  RabbitMQHandler* rabbitMQHandler;
 
22
public:
 
23
 
 
24
  /**
 
25
   * @brief
 
26
   *   Constructs a new RabbitMQLog.
 
27
   *
 
28
   * @details
 
29
   *  Takes an instance of RabbitMHandler and uses that for rabbitmq communication
 
30
   *
 
31
   * @param[in] mqHandler name of the plugin, typically rabbitmq_log.
 
32
   */
 
33
  RabbitMQLog(const std::string name_arg, 
 
34
              RabbitMQHandler* mqHandler);
 
35
  ~RabbitMQLog();
 
36
 
 
37
  /**
 
38
   * @brief
 
39
   *   Serializes the transaction and uses a RabbiMQHandler to publish the message.
 
40
   *
 
41
   * @details
 
42
   *   Serializes the protobuf transaction and drops it on rabbitmq
 
43
   *
 
44
   * @param[in] to_apply the transaction to send
 
45
   */
 
46
  void apply(const drizzled::message::Transaction &to_apply);
 
47
 
 
48
};
 
49
 
 
50
#endif