mq_manager.hpp
1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* @Author: yangzilong
* @Date: 2021-12-15 14:52:35
* @Last Modified by: yangzilong
* @Email: yangzilong@objecteye.com
* @Description:
*/
#pragma once
#include "./post_reprocessing.hpp"
#include <map>
#include <memory>
#ifdef POST_USE_RABBITMQ
namespace mq
{
typedef mq_type_t key_t;
typedef post_rabbitmq_reprocessing value_t;
typedef rabbitmq_conn_params_t value_param_t;
class Manager
{
/**
* @brief is not thread safe.
*
*/
public:
Manager();
bool add_conn(const key_t &key, const value_param_t& value_param);
bool del_conn(const key_t &key);
bool publish(const key_t &key, const char *msg, bool verbose = false);
/* remove copy construct and copy assignment. */
Manager(const Manager &) = delete;
Manager& operator=(const Manager &) = delete;
private:
std::map<key_t, std::shared_ptr<value_t>> task_status_to_mq_handle_;
};
} // namespace mq
#endif // #ifdef POST_USE_RABBITMQ