您的位置:首页 > 游戏 > 手游 > 河南省工程建设信息网一体化平台_品牌seo是什么意思_湘潭网站设计外包公司_uc浏览网页版进入

河南省工程建设信息网一体化平台_品牌seo是什么意思_湘潭网站设计外包公司_uc浏览网页版进入

2024/10/5 18:30:37 来源:https://blog.csdn.net/weixin_74113106/article/details/142577333  浏览:    关键词:河南省工程建设信息网一体化平台_品牌seo是什么意思_湘潭网站设计外包公司_uc浏览网页版进入
河南省工程建设信息网一体化平台_品牌seo是什么意思_湘潭网站设计外包公司_uc浏览网页版进入

和服务端的消费者实现方式一模一样,只不过服务端的消费者的回调函数是把消息封装成响应并发送,固定都是这个动作,而客户端消费者回调是用来处理消息,是用户自己设置的。

#pragma once
#include "../common/Log.hpp"
#include "../common/message.pb.h"
#include <functional>
#include <memory>
#include <atomic>
#include <mutex>
#include <vector>
#include <unordered_map>
namespace ns_consumer
{using namespace ns_log;struct Consumer;using ConsumerPtr = std::shared_ptr<Consumer>;using ConsumerCallback_t = std::function<void(const ns_data::Message& msg)>;struct Consumer{std::string _id;std::string _qname;ConsumerCallback_t _callback;bool _autoAck;Consumer(const std::string id, const std::string &qname, ConsumerCallback_t callback, bool autoAck): _id(id),_qname(qname),_callback(callback),_autoAck(autoAck){}};
};

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com