Message-Queues beta 1.1
A Message-Queues based Cpp
 
载入中...
搜索中...
未找到
consumer.hpp
浏览该文件的文档.
1
5
6#pragma once
7#include "../common/logger.hpp"
8#include "../common/helper.hpp"
9#include "../common/msg.pb.h"
10#include <iostream>
11#include <unordered_map>
12#include <vector>
13#include <mutex>
14#include <memory>
15#include <functional>
16
17namespace XuMQ
18{
19 using ConsumerCallback = std::function<void(const std::string &, const BasicProperties *, const std::string &)>;
22 struct Consumer
23 {
24 using ptr = std::shared_ptr<Consumer>;
25 std::string tag;
26 std::string qname;
27 bool auto_ack;
29
37 Consumer(const std::string &ctag, const std::string &queue_name, bool ack, const ConsumerCallback &cb)
38 : tag(ctag), qname(queue_name), auto_ack(ack), callback(cb) {}
39 };
40}
Definition msg.pb.h:122
Definition channel.hpp:22
std::function< void(const std::string &, const BasicProperties *, const std::string &)> ConsumerCallback
消费者回调函数
Definition consumer.hpp:19
消费者对象结构
Definition consumer.hpp:23
Consumer(const std::string &ctag, const std::string &queue_name, bool ack, const ConsumerCallback &cb)
消费者构造函数
Definition consumer.hpp:37
ConsumerCallback callback
消费者回调函数
Definition consumer.hpp:28
std::string qname
消费者订阅的队列名称
Definition consumer.hpp:26
std::shared_ptr< Consumer > ptr
消费者结构管理指针
Definition consumer.hpp:24
bool auto_ack
自动确认标志
Definition consumer.hpp:27
std::string tag
消费者标识
Definition consumer.hpp:25
Consumer()
无参构造函数
Definition consumer.hpp:31