~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/rabbitmq/rabbitmq_handler.h

  • Committer: Lee Bieber
  • Date: 2011-04-02 15:51:08 UTC
  • mfrom: (2258.2.4 drizzle)
  • Revision ID: kalebral@gmail.com-20110402155108-ux162y1xly0z0x72
Merge Marcuse - Adds a mutex that makes the rabbitmq plugin thread safe

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
  const std::string &username;
67
67
  const std::string &password;
68
68
  const std::string &virtualhost;
 
69
  const std::string &exchange;
 
70
  const std::string &routingKey;
 
71
  pthread_mutex_t publishLock;
69
72
public:
70
73
  /**
71
74
   * @brief
87
90
                  const in_port_t port, 
88
91
                  const std::string &username, 
89
92
                  const std::string &password, 
90
 
                  const std::string &virtualhost)
 
93
                  const std::string &virtualhost,
 
94
                  const std::string &exchange,
 
95
                  const std::string &routingKey)
91
96
    throw(rabbitmq_handler_exception);
92
97
 
93
98
  ~RabbitMQHandler();
101
106
   *
102
107
   * @param[in] message the message to send
103
108
   * @param[in] length the length of the message
104
 
   * @param[in] exchangeName name of the exchange to publish to
105
 
   * @param[in] routingKey the routing key to use
106
109
   * @throw exception if there is a problem publishing
107
110
   */
108
111
  void publish(void *message, 
109
 
               const int length, 
110
 
               const std::string &exchangeName, 
111
 
               const std::string &routingKey)
 
112
               const int length)
112
113
    throw(rabbitmq_handler_exception);
113
114
 
 
115
  void reconnect() throw(rabbitmq_handler_exception);
 
116
  void disconnect() throw(rabbitmq_handler_exception);
114
117
 
115
118
private:
116
119
  /**
126
129
   * @throw exception with the message unless the command was successful
127
130
   */
128
131
  void handleAMQPError(amqp_rpc_reply_t x, std::string context) throw(rabbitmq_handler_exception);
 
132
 
 
133
  void connect() throw(rabbitmq_handler_exception);
 
134
 
129
135
};
130
136
 
131
137
} /* namespace drizzle_plugin */