20std::optional<NotificationData>
22 const std::string& expected_from ,
36 TLOG() <<
"AAA " << __LINE__ <<
" getting receiver for UID \"" <<
id <<
"\"";
37 std::optional<NotificationData> msg =
40 if (msg.has_value()) {
41 TLOG() <<
"debug : Received request " << msg->m_notification <<
" for " << msg->m_target_id;
43 if (expected_from !=
"" && expected_from.find(msg.value().m_source_id) == std::string::npos) {
44 TLOG() <<
"debug : Received request from " << msg->m_source_id <<
" but expected from " << expected_from
58 const std::string& src,
59 const std::string& dst,
60 const std::string& id_conn,
61 const std::string& data,
70 std::string real_conn_id = id_conn;
72 if (conn.find(id_conn) != std::string::npos) {
78 if (conn.find(id_conn) != std::string::npos) {
91 ->try_send(std::move(notif_data), std::chrono::milliseconds(
m_timeout_send));
93 if (result ==
false) {
100 std::this_thread::sleep_for(std::chrono::milliseconds(
m_timeout_send));
101 TLOG() <<
"debug : Retrying send notification";
static std::shared_ptr< IOManager > get()
std::optional< NotificationData > listen_for_notification(const std::string &id, const std::string &expected_from="", int timeout=-1, int tries=-1)
Listen for a notification.
int m_timeout_send
Timeout for sending a notification in ms.
std::set< std::string > m_clients_conn
List of clients connections.
int m_timeout_receive
Timeout for receiving a notification in ms.
bool send_notification(const notification_type::e_notification_type ¬if, const std::string &src, const std::string &dst, const std::string &id_conn, const std::string &data="", int tries=-1)
Send a notification during m_timeout_send ms.
std::vector< std::string > m_bookkeepers_conn
List of bookkeepers connections.
void error(const Issue &issue)
NotificationData class, represent a notification.
static std::string notification_to_string(e_notification_type e)
e_notification_type
Different type of notifications possible to send.