| | |
| | | const MQInfo &BusAddr() const { return BHTopicBusAddress(shm()); } |
| | | |
| | | public: |
| | | TopicNode(SharedMemory &shm); |
| | | TopicNode(SharedMemory &shm, MQId ssn_id = 0); |
| | | ~TopicNode(); |
| | | |
| | | // topic node |
| | |
| | | // subscribe |
| | | typedef std::function<void(const std::string &proc_id, const MsgPublish &data)> SubDataCB; |
| | | bool SubscribeStartWorker(const SubDataCB &tdcb, int nworker = 2); |
| | | bool Subscribe(MsgTopicList &topics, MsgCommonReply &reply_body, const int timeout_ms); |
| | | bool Subscribe(MsgTopicList &topics, MsgCommonReply &reply_body, const int timeout_ms) |
| | | { |
| | | return DoSubscribe(topics, false, reply_body, timeout_ms); |
| | | } |
| | | bool SubscribeNet(MsgTopicList &topics, MsgCommonReply &reply_body, const int timeout_ms) |
| | | { |
| | | return DoSubscribe(topics, true, reply_body, timeout_ms); |
| | | } |
| | | bool DoSubscribe(MsgTopicList &topics, const bool net, MsgCommonReply &reply_body, const int timeout_ms); |
| | | bool RecvSub(std::string &proc_id, MsgPublish &pub, const int timeout_ms); |
| | | |
| | | void Start(ServerAsyncCB const &server_cb, SubDataCB const &sub_cb, RequestResultCB &client_cb, int nworker = 2); |
| | |
| | | bool Init(); |
| | | bool Valid() const { return state() != eStateUninited; } |
| | | std::mutex mutex_; |
| | | MQId ssn_id_ = 0; |
| | | std::atomic<State> state_; |
| | | MQId ssn_id_ = 0; |
| | | int proc_index_ = -1; |
| | | |
| | | TopicQueryCache topic_query_cache_; |