Removed dependency to TriggerManager

introduces Messanger class which allows to send messages directly to
subscribed targets, which allows to break dependencies between classes.

Testes:
- All unit tests are passing
- Links are correctly updated
- Report is correctly updated by Trigger Action

Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I32d3aaba22f9ec07e611f53fe553bd27e1c04c6d
diff --git a/src/interfaces/report.hpp b/src/interfaces/report.hpp
index 122afdf..3415712 100644
--- a/src/interfaces/report.hpp
+++ b/src/interfaces/report.hpp
@@ -14,8 +14,5 @@
 
     virtual std::string getId() const = 0;
     virtual std::string getPath() const = 0;
-    virtual void updateReadings() = 0;
-    virtual void updateTriggerIds(const std::string& triggerId,
-                                  TriggerIdUpdate updateType) = 0;
 };
 } // namespace interfaces
diff --git a/src/interfaces/report_factory.hpp b/src/interfaces/report_factory.hpp
index f5a1c5b..6a255a4 100644
--- a/src/interfaces/report_factory.hpp
+++ b/src/interfaces/report_factory.hpp
@@ -26,14 +26,15 @@
         convertMetricParams(boost::asio::yield_context& yield,
                             const ReadingParameters& metricParams) const = 0;
 
-    virtual std::unique_ptr<interfaces::Report> make(
-        const std::string& id, const std::string& name,
-        const ReportingType reportingType,
-        const std::vector<ReportAction>& reportActions, Milliseconds period,
-        uint64_t appendLimit, const ReportUpdates reportUpdates,
-        ReportManager& reportManager, JsonStorage& reportStorage,
-        std::vector<LabeledMetricParameters> labeledMetricParams, bool enabled,
-        const std::vector<std::string>& triggerIds) const = 0;
+    virtual std::unique_ptr<interfaces::Report>
+        make(const std::string& id, const std::string& name,
+             const ReportingType reportingType,
+             const std::vector<ReportAction>& reportActions,
+             Milliseconds period, uint64_t appendLimit,
+             const ReportUpdates reportUpdates, ReportManager& reportManager,
+             JsonStorage& reportStorage,
+             std::vector<LabeledMetricParameters> labeledMetricParams,
+             bool enabled) const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/report_manager.hpp b/src/interfaces/report_manager.hpp
index a390f41..323f13b 100644
--- a/src/interfaces/report_manager.hpp
+++ b/src/interfaces/report_manager.hpp
@@ -12,10 +12,6 @@
     virtual ~ReportManager() = default;
 
     virtual void removeReport(const interfaces::Report* report) = 0;
-    virtual void updateReport(const std::string& id) = 0;
-    virtual void updateTriggerIds(const std::string& reportId,
-                                  const std::string& triggerId,
-                                  TriggerIdUpdate updateType) = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/trigger.hpp b/src/interfaces/trigger.hpp
index 7ad47ae..c76c019 100644
--- a/src/interfaces/trigger.hpp
+++ b/src/interfaces/trigger.hpp
@@ -13,7 +13,6 @@
 
     virtual std::string getId() const = 0;
     virtual std::string getPath() const = 0;
-    virtual const std::vector<std::string>& getReportIds() const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/trigger_manager.hpp b/src/interfaces/trigger_manager.hpp
index 28e11f3..878fd57 100644
--- a/src/interfaces/trigger_manager.hpp
+++ b/src/interfaces/trigger_manager.hpp
@@ -11,9 +11,6 @@
     virtual ~TriggerManager() = default;
 
     virtual void removeTrigger(const Trigger* trigger) = 0;
-
-    virtual std::vector<std::string>
-        getTriggerIdsForReport(const std::string& reportId) const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/messages/collect_trigger_id.hpp b/src/messages/collect_trigger_id.hpp
new file mode 100644
index 0000000..aba3e5a
--- /dev/null
+++ b/src/messages/collect_trigger_id.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <string>
+
+namespace messages
+{
+
+struct CollectTriggerIdReq
+{
+    std::string reportId;
+};
+
+struct CollectTriggerIdResp
+{
+    std::string triggerId;
+};
+
+} // namespace messages
diff --git a/src/messages/presence.hpp b/src/messages/presence.hpp
new file mode 100644
index 0000000..bd618ed
--- /dev/null
+++ b/src/messages/presence.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+namespace messages
+{
+
+enum class Presence
+{
+    Exist,
+    Removed
+};
+
+} // namespace messages
diff --git a/src/messages/trigger_presence_changed_ind.hpp b/src/messages/trigger_presence_changed_ind.hpp
new file mode 100644
index 0000000..217b7e4
--- /dev/null
+++ b/src/messages/trigger_presence_changed_ind.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "messages/presence.hpp"
+
+#include <string>
+#include <vector>
+
+namespace messages
+{
+
+struct TriggerPresenceChangedInd
+{
+    Presence presence;
+    std::string triggerId;
+    std::vector<std::string> reportIds;
+};
+
+} // namespace messages
diff --git a/src/messages/update_report_ind.hpp b/src/messages/update_report_ind.hpp
new file mode 100644
index 0000000..2ef8c3d
--- /dev/null
+++ b/src/messages/update_report_ind.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <string>
+#include <vector>
+
+namespace messages
+{
+
+struct UpdateReportInd
+{
+    std::vector<std::string> reportIds;
+};
+
+} // namespace messages
diff --git a/src/report.cpp b/src/report.cpp
index 6439d41..18ca9c1 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -1,5 +1,8 @@
 #include "report.hpp"
 
+#include "messages/collect_trigger_id.hpp"
+#include "messages/trigger_presence_changed_ind.hpp"
+#include "messages/update_report_ind.hpp"
 #include "report_manager.hpp"
 #include "utils/clock.hpp"
 #include "utils/contains.hpp"
@@ -21,8 +24,7 @@
                interfaces::ReportManager& reportManager,
                interfaces::JsonStorage& reportStorageIn,
                std::vector<std::shared_ptr<interfaces::Metric>> metricsIn,
-               const bool enabledIn, std::unique_ptr<interfaces::Clock> clock,
-               const std::vector<std::string>& triggerIdsIn) :
+               const bool enabledIn, std::unique_ptr<interfaces::Clock> clock) :
     id(reportId),
     name(reportName), reportingType(reportingTypeIn), interval(intervalIn),
     reportActions(std::move(reportActionsIn)),
@@ -31,8 +33,8 @@
     reportUpdates(reportUpdatesIn),
     readingsBuffer(deduceBufferSize(reportUpdates, reportingType)),
     objServer(objServer), metrics(std::move(metricsIn)), timer(ioc),
-    triggerIds(triggerIdsIn.begin(), triggerIdsIn.end()),
-    reportStorage(reportStorageIn), enabled(enabledIn), clock(std::move(clock))
+    triggerIds(collectTriggerIds(ioc)), reportStorage(reportStorageIn),
+    enabled(enabledIn), clock(std::move(clock)), messanger(ioc)
 {
     readingParameters =
         toReadingParameters(utils::transform(metrics, [](const auto& metric) {
@@ -78,6 +80,39 @@
             metric->initialize();
         }
     }
+
+    messanger.on_receive<messages::TriggerPresenceChangedInd>(
+        [this](const auto& msg) {
+            const auto oldSize = triggerIds.size();
+
+            if (msg.presence == messages::Presence::Exist)
+            {
+                if (utils::contains(msg.reportIds, id))
+                {
+                    triggerIds.insert(msg.triggerId);
+                }
+                else if (!utils::contains(msg.reportIds, id))
+                {
+                    triggerIds.erase(msg.triggerId);
+                }
+            }
+            else if (msg.presence == messages::Presence::Removed)
+            {
+                triggerIds.erase(msg.triggerId);
+            }
+
+            if (triggerIds.size() != oldSize)
+            {
+                reportIface->signal_property("TriggerIds");
+            }
+        });
+
+    messanger.on_receive<messages::UpdateReportInd>([this](const auto& msg) {
+        if (utils::contains(msg.reportIds, id))
+        {
+            updateReadings();
+        }
+    });
 }
 
 uint64_t Report::getSensorCount(
@@ -377,21 +412,17 @@
         std::to_string(std::hash<std::string>{}(id))};
 }
 
-void Report::updateTriggerIds(const std::string& triggerId,
-                              TriggerIdUpdate updateType)
+std::unordered_set<std::string>
+    Report::collectTriggerIds(boost::asio::io_context& ioc) const
 {
-    if (updateType == TriggerIdUpdate::Add)
-    {
-        if (triggerIds.insert(triggerId).second)
-        {
-            reportIface->signal_property("TriggerIds");
-        }
-    }
-    else if (updateType == TriggerIdUpdate::Remove)
-    {
-        if (triggerIds.erase(triggerId) > 0)
-        {
-            reportIface->signal_property("TriggerIds");
-        }
-    }
+    utils::Messanger tmp(ioc);
+
+    auto result = std::unordered_set<std::string>();
+
+    tmp.on_receive<messages::CollectTriggerIdResp>(
+        [&result](const auto& msg) { result.insert(msg.triggerId); });
+
+    tmp.send(messages::CollectTriggerIdReq{id});
+
+    return result;
 }
diff --git a/src/report.hpp b/src/report.hpp
index 3e649fd..5ac6fd0 100644
--- a/src/report.hpp
+++ b/src/report.hpp
@@ -10,6 +10,7 @@
 #include "types/report_updates.hpp"
 #include "types/reporting_type.hpp"
 #include "utils/circular_vector.hpp"
+#include "utils/messanger.hpp"
 
 #include <boost/asio/io_context.hpp>
 #include <boost/asio/steady_timer.hpp>
@@ -31,8 +32,7 @@
            interfaces::ReportManager& reportManager,
            interfaces::JsonStorage& reportStorage,
            std::vector<std::shared_ptr<interfaces::Metric>> metrics,
-           const bool enabled, std::unique_ptr<interfaces::Clock> clock,
-           const std::vector<std::string>& triggerIds);
+           const bool enabled, std::unique_ptr<interfaces::Clock> clock);
 
     Report(const Report&) = delete;
     Report(Report&&) = delete;
@@ -49,11 +49,6 @@
         return reportDir + id;
     }
 
-    void updateReadings() override;
-    void updateTriggerIds(const std::string& triggerId,
-                          TriggerIdUpdate updateType) override;
-    bool storeConfiguration() const;
-
   private:
     std::unique_ptr<sdbusplus::asio::dbus_interface> makeReportInterface();
     static void timerProc(boost::system::error_code, Report& self);
@@ -66,6 +61,10 @@
     static uint64_t getSensorCount(
         std::vector<std::shared_ptr<interfaces::Metric>>& metrics);
     interfaces::JsonStorage::FilePath fileName() const;
+    std::unordered_set<std::string>
+        collectTriggerIds(boost::asio::io_context& ioc) const;
+    bool storeConfiguration() const;
+    void updateReadings();
 
     std::string id;
     std::string name;
@@ -90,6 +89,7 @@
     interfaces::JsonStorage& reportStorage;
     bool enabled;
     std::unique_ptr<interfaces::Clock> clock;
+    utils::Messanger messanger;
 
   public:
     static constexpr const char* reportIfaceName =
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index df197a4..df71fa0 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -23,8 +23,8 @@
     uint64_t appendLimit, const ReportUpdates reportUpdates,
     interfaces::ReportManager& reportManager,
     interfaces::JsonStorage& reportStorage,
-    std::vector<LabeledMetricParameters> labeledMetricParams, bool enabled,
-    const std::vector<std::string>& triggerIds) const
+    std::vector<LabeledMetricParameters> labeledMetricParams,
+    bool enabled) const
 {
     std::vector<std::shared_ptr<interfaces::Metric>> metrics = utils::transform(
         labeledMetricParams,
@@ -40,11 +40,10 @@
                 std::make_unique<Clock>());
         });
 
-    return std::make_unique<Report>(bus->get_io_context(), objServer, id, name,
-                                    reportingType, reportActions, period,
-                                    appendLimit, reportUpdates, reportManager,
-                                    reportStorage, std::move(metrics), enabled,
-                                    std::make_unique<Clock>(), triggerIds);
+    return std::make_unique<Report>(
+        bus->get_io_context(), objServer, id, name, reportingType,
+        reportActions, period, appendLimit, reportUpdates, reportManager,
+        reportStorage, std::move(metrics), enabled, std::make_unique<Clock>());
 }
 
 Sensors ReportFactory::getSensors(
diff --git a/src/report_factory.hpp b/src/report_factory.hpp
index e841be1..14f9f39 100644
--- a/src/report_factory.hpp
+++ b/src/report_factory.hpp
@@ -20,15 +20,16 @@
         boost::asio::yield_context& yield,
         const ReadingParameters& metricParams) const override;
 
-    std::unique_ptr<interfaces::Report> make(
-        const std::string& reportId, const std::string& name,
-        const ReportingType reportingType,
-        const std::vector<ReportAction>& reportActions, Milliseconds period,
-        uint64_t appendLimitIn, const ReportUpdates reportUpdatesIn,
-        interfaces::ReportManager& reportManager,
-        interfaces::JsonStorage& reportStorage,
-        std::vector<LabeledMetricParameters> labeledMetricParams, bool enabled,
-        const std::vector<std::string>& triggerIds) const override;
+    std::unique_ptr<interfaces::Report>
+        make(const std::string& reportId, const std::string& name,
+             const ReportingType reportingType,
+             const std::vector<ReportAction>& reportActions,
+             Milliseconds period, uint64_t appendLimitIn,
+             const ReportUpdates reportUpdatesIn,
+             interfaces::ReportManager& reportManager,
+             interfaces::JsonStorage& reportStorage,
+             std::vector<LabeledMetricParameters> labeledMetricParams,
+             bool enabled) const override;
 
   private:
     Sensors getSensors(const std::vector<LabeledSensorInfo>& sensorPaths) const;
diff --git a/src/report_manager.cpp b/src/report_manager.cpp
index 9b7b9ef..df60075 100644
--- a/src/report_manager.cpp
+++ b/src/report_manager.cpp
@@ -32,11 +32,9 @@
 ReportManager::ReportManager(
     std::unique_ptr<interfaces::ReportFactory> reportFactoryIn,
     std::unique_ptr<interfaces::JsonStorage> reportStorageIn,
-    const std::shared_ptr<sdbusplus::asio::object_server>& objServerIn,
-    std::unique_ptr<interfaces::TriggerManager>& triggerManagerIn) :
+    const std::shared_ptr<sdbusplus::asio::object_server>& objServerIn) :
     reportFactory(std::move(reportFactoryIn)),
-    reportStorage(std::move(reportStorageIn)), objServer(objServerIn),
-    triggerManager(triggerManagerIn)
+    reportStorage(std::move(reportStorageIn)), objServer(objServerIn)
 {
     reports.reserve(maxReports);
 
@@ -225,16 +223,9 @@
     verifyAddReport(id, name, reportingType, interval, reportUpdates,
                     appendLimit, labeledMetricParams);
 
-    std::vector<std::string> triggerIds;
-    if (triggerManager)
-    {
-        triggerIds = triggerManager->getTriggerIdsForReport(id);
-    }
-
-    reports.emplace_back(
-        reportFactory->make(id, name, reportingType, reportActions, interval,
-                            appendLimit, reportUpdates, *this, *reportStorage,
-                            labeledMetricParams, enabled, triggerIds));
+    reports.emplace_back(reportFactory->make(
+        id, name, reportingType, reportActions, interval, appendLimit,
+        reportUpdates, *this, *reportStorage, labeledMetricParams, enabled));
     return *reports.back();
 }
 
@@ -287,29 +278,3 @@
         }
     }
 }
-
-void ReportManager::updateReport(const std::string& id)
-{
-    for (auto& report : reports)
-    {
-        if (report->getId() == id)
-        {
-            report->updateReadings();
-            return;
-        }
-    }
-}
-
-void ReportManager::updateTriggerIds(const std::string& reportId,
-                                     const std::string& triggerId,
-                                     TriggerIdUpdate updateType)
-{
-    if (auto res = std::find_if(reports.begin(), reports.end(),
-                                [&reportId](const auto& report) {
-                                    return report->getId() == reportId;
-                                });
-        res != reports.end())
-    {
-        (*res)->updateTriggerIds(triggerId, updateType);
-    }
-}
diff --git a/src/report_manager.hpp b/src/report_manager.hpp
index 85fbfa9..96e7cab 100644
--- a/src/report_manager.hpp
+++ b/src/report_manager.hpp
@@ -22,8 +22,7 @@
     ReportManager(
         std::unique_ptr<interfaces::ReportFactory> reportFactory,
         std::unique_ptr<interfaces::JsonStorage> reportStorage,
-        const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
-        std::unique_ptr<interfaces::TriggerManager>& triggerManager);
+        const std::shared_ptr<sdbusplus::asio::object_server>& objServer);
     ~ReportManager() = default;
 
     ReportManager(const ReportManager&) = delete;
@@ -32,10 +31,6 @@
     ReportManager& operator=(ReportManager&&) = delete;
 
     void removeReport(const interfaces::Report* report) override;
-    void updateReport(const std::string& id) override;
-    void updateTriggerIds(const std::string& reportId,
-                          const std::string& triggerId,
-                          TriggerIdUpdate updateType) override;
 
   private:
     std::unique_ptr<interfaces::ReportFactory> reportFactory;
@@ -43,7 +38,6 @@
     std::shared_ptr<sdbusplus::asio::object_server> objServer;
     std::unique_ptr<sdbusplus::asio::dbus_interface> reportManagerIface;
     std::vector<std::unique_ptr<interfaces::Report>> reports;
-    std::unique_ptr<interfaces::TriggerManager>& triggerManager;
 
     void verifyAddReport(
         const std::string& reportId, const std::string& reportName,
diff --git a/src/telemetry.hpp b/src/telemetry.hpp
index c3f8f17..e671b6c 100644
--- a/src/telemetry.hpp
+++ b/src/telemetry.hpp
@@ -22,19 +22,18 @@
             std::make_unique<PersistentJsonStorage>(
                 interfaces::JsonStorage::DirectoryPath(
                     "/var/lib/telemetry/Reports")),
-            objServer, triggerManager),
-        triggerManager(std::make_unique<TriggerManager>(
-            std::make_unique<TriggerFactory>(bus, objServer, sensorCache,
-                                             reportManager),
+            objServer),
+        triggerManager(
+            std::make_unique<TriggerFactory>(bus, objServer, sensorCache),
             std::make_unique<PersistentJsonStorage>(
                 interfaces::JsonStorage::DirectoryPath(
                     "/var/lib/telemetry/Triggers")),
-            objServer))
+            objServer)
     {}
 
   private:
     std::shared_ptr<sdbusplus::asio::object_server> objServer;
     mutable SensorCache sensorCache;
     ReportManager reportManager;
-    std::unique_ptr<interfaces::TriggerManager> triggerManager;
+    TriggerManager triggerManager;
 };
diff --git a/src/trigger.cpp b/src/trigger.cpp
index 34609b3..6982267 100644
--- a/src/trigger.cpp
+++ b/src/trigger.cpp
@@ -1,8 +1,11 @@
 #include "trigger.hpp"
 
+#include "messages/collect_trigger_id.hpp"
+#include "messages/trigger_presence_changed_ind.hpp"
 #include "trigger_manager.hpp"
 #include "types/report_types.hpp"
 #include "types/trigger_types.hpp"
+#include "utils/contains.hpp"
 #include "utils/conversion_trigger.hpp"
 #include "utils/transform.hpp"
 
@@ -17,15 +20,14 @@
     std::vector<std::shared_ptr<interfaces::Threshold>>&& thresholdsIn,
     interfaces::TriggerManager& triggerManager,
     interfaces::JsonStorage& triggerStorageIn,
-    const interfaces::TriggerFactory& triggerFactory, Sensors sensorsIn,
-    interfaces::ReportManager& reportManagerIn) :
+    const interfaces::TriggerFactory& triggerFactory, Sensors sensorsIn) :
     id(idIn),
     name(nameIn), triggerActions(std::move(triggerActionsIn)),
     path(triggerDir + id), reportIds(std::move(reportIdsIn)),
     thresholds(std::move(thresholdsIn)),
     fileName(std::to_string(std::hash<std::string>{}(id))),
     triggerStorage(triggerStorageIn), sensors(std::move(sensorsIn)),
-    reportManager(reportManagerIn)
+    messanger(ioc)
 {
     deleteIface = objServer->add_unique_interface(
         path, deleteIfaceName, [this, &ioc, &triggerManager](auto& dbusIface) {
@@ -34,11 +36,8 @@
                 {
                     triggerStorage.remove(fileName);
                 }
-                for (const auto& reportId : *reportIds)
-                {
-                    reportManager.updateTriggerIds(reportId, id,
-                                                   TriggerIdUpdate::Remove);
-                }
+                messanger.send(messages::TriggerPresenceChangedInd{
+                    messages::Presence::Removed, id, {}});
                 boost::asio::post(ioc, [this, &triggerManager] {
                     triggerManager.removeTrigger(this);
                 });
@@ -114,10 +113,9 @@
                 sdbusplus::vtable::property_::emits_change,
                 [this](auto newVal, auto& oldVal) {
                     TriggerManager::verifyReportIds(newVal);
-                    updateTriggerIdsInReports(newVal);
-                    reportIds->clear();
-                    std::copy(newVal.begin(), newVal.end(),
-                              std::back_inserter(*reportIds));
+                    *reportIds = newVal;
+                    messanger.send(messages::TriggerPresenceChangedInd{
+                        messages::Presence::Exist, id, *reportIds});
                     oldVal = std::move(newVal);
                     return 1;
                 },
@@ -155,10 +153,16 @@
         threshold->initialize();
     }
 
-    for (const auto& reportId : *reportIds)
-    {
-        reportManager.updateTriggerIds(reportId, id, TriggerIdUpdate::Add);
-    }
+    messanger.on_receive<messages::CollectTriggerIdReq>(
+        [this](const auto& msg) {
+            if (utils::contains(*reportIds, msg.reportId))
+            {
+                messanger.send(messages::CollectTriggerIdResp{id});
+            }
+        });
+
+    messanger.send(messages::TriggerPresenceChangedInd{
+        messages::Presence::Exist, id, *reportIds});
 }
 
 bool Trigger::storeConfiguration() const
@@ -200,26 +204,3 @@
     }
     return true;
 }
-
-void Trigger::updateTriggerIdsInReports(
-    const std::vector<std::string>& newReportIds)
-{
-    std::vector<std::string> toBeRemoved, toBeAdded;
-    size_t maxSize = std::max(reportIds->size(), newReportIds.size());
-    toBeRemoved.reserve(maxSize);
-    toBeAdded.reserve(maxSize);
-    std::set_difference(reportIds->begin(), reportIds->end(),
-                        newReportIds.begin(), newReportIds.end(),
-                        std::back_inserter(toBeRemoved));
-    std::set_difference(newReportIds.begin(), newReportIds.end(),
-                        reportIds->begin(), reportIds->end(),
-                        std::back_inserter(toBeAdded));
-    for (auto& reportId : toBeRemoved)
-    {
-        reportManager.updateTriggerIds(reportId, id, TriggerIdUpdate::Remove);
-    }
-    for (auto& reportId : toBeAdded)
-    {
-        reportManager.updateTriggerIds(reportId, id, TriggerIdUpdate::Add);
-    }
-}
diff --git a/src/trigger.hpp b/src/trigger.hpp
index 67c6a7f..b7ef182 100644
--- a/src/trigger.hpp
+++ b/src/trigger.hpp
@@ -1,12 +1,12 @@
 #pragma once
 
 #include "interfaces/json_storage.hpp"
-#include "interfaces/report_manager.hpp"
 #include "interfaces/threshold.hpp"
 #include "interfaces/trigger.hpp"
 #include "interfaces/trigger_factory.hpp"
 #include "interfaces/trigger_manager.hpp"
 #include "types/trigger_types.hpp"
+#include "utils/messanger.hpp"
 
 #include <boost/asio/io_context.hpp>
 #include <sdbusplus/asio/object_server.hpp>
@@ -24,8 +24,8 @@
             std::vector<std::shared_ptr<interfaces::Threshold>>&& thresholds,
             interfaces::TriggerManager& triggerManager,
             interfaces::JsonStorage& triggerStorage,
-            const interfaces::TriggerFactory& triggerFactory, Sensors sensorsIn,
-            interfaces::ReportManager& reportManager);
+            const interfaces::TriggerFactory& triggerFactory,
+            Sensors sensorsIn);
 
     Trigger(const Trigger&) = delete;
     Trigger(Trigger&&) = delete;
@@ -44,11 +44,6 @@
 
     bool storeConfiguration() const;
 
-    const std::vector<std::string>& getReportIds() const override
-    {
-        return *reportIds;
-    }
-
   private:
     std::string id;
     std::string name;
@@ -63,10 +58,7 @@
     interfaces::JsonStorage::FilePath fileName;
     interfaces::JsonStorage& triggerStorage;
     Sensors sensors;
-    interfaces::ReportManager& reportManager;
-
-    void
-        updateTriggerIdsInReports(const std::vector<std::string>& newReportIds);
+    utils::Messanger messanger;
 
   public:
     static constexpr const char* triggerIfaceName =
diff --git a/src/trigger_actions.cpp b/src/trigger_actions.cpp
index 0a627e6..89ddfcc 100644
--- a/src/trigger_actions.cpp
+++ b/src/trigger_actions.cpp
@@ -1,5 +1,8 @@
 #include "trigger_actions.hpp"
 
+#include "messages/update_report_ind.hpp"
+#include "utils/messanger.hpp"
+
 #include <phosphor-logging/log.hpp>
 
 #include <ctime>
@@ -98,7 +101,7 @@
 void fillActions(
     std::vector<std::unique_ptr<interfaces::TriggerAction>>& actionsIf,
     const std::vector<TriggerAction>& ActionsEnum, ::numeric::Type type,
-    double thresholdValue, interfaces::ReportManager& reportManager,
+    double thresholdValue, boost::asio::io_context& ioc,
     const std::shared_ptr<std::vector<std::string>>& reportIds)
 {
     actionsIf.reserve(ActionsEnum.size());
@@ -121,7 +124,7 @@
             case TriggerAction::UpdateReport:
             {
                 actionsIf.emplace_back(
-                    std::make_unique<UpdateReport>(reportManager, reportIds));
+                    std::make_unique<UpdateReport>(ioc, reportIds));
                 break;
             }
         }
@@ -184,7 +187,7 @@
 void fillActions(
     std::vector<std::unique_ptr<interfaces::TriggerAction>>& actionsIf,
     const std::vector<TriggerAction>& ActionsEnum,
-    ::discrete::Severity severity, interfaces::ReportManager& reportManager,
+    ::discrete::Severity severity, boost::asio::io_context& ioc,
     const std::shared_ptr<std::vector<std::string>>& reportIds)
 {
     actionsIf.reserve(ActionsEnum.size());
@@ -207,7 +210,7 @@
             case TriggerAction::UpdateReport:
             {
                 actionsIf.emplace_back(
-                    std::make_unique<UpdateReport>(reportManager, reportIds));
+                    std::make_unique<UpdateReport>(ioc, reportIds));
                 break;
             }
         }
@@ -239,8 +242,7 @@
 
 void fillActions(
     std::vector<std::unique_ptr<interfaces::TriggerAction>>& actionsIf,
-    const std::vector<TriggerAction>& ActionsEnum,
-    interfaces::ReportManager& reportManager,
+    const std::vector<TriggerAction>& ActionsEnum, boost::asio::io_context& ioc,
     const std::shared_ptr<std::vector<std::string>>& reportIds)
 {
     actionsIf.reserve(ActionsEnum.size());
@@ -261,7 +263,7 @@
             case TriggerAction::UpdateReport:
             {
                 actionsIf.emplace_back(
-                    std::make_unique<UpdateReport>(reportManager, reportIds));
+                    std::make_unique<UpdateReport>(ioc, reportIds));
                 break;
             }
         }
@@ -272,9 +274,12 @@
 
 void UpdateReport::commit(const std::string&, Milliseconds, double)
 {
-    for (const auto& name : *reportIds)
+    if (reportIds->empty())
     {
-        reportManager.updateReport(name);
+        return;
     }
+
+    utils::Messanger messanger(ioc);
+    messanger.send(messages::UpdateReportInd{*reportIds});
 }
 } // namespace action
diff --git a/src/trigger_actions.hpp b/src/trigger_actions.hpp
index 99a1baa..cca4bb9 100644
--- a/src/trigger_actions.hpp
+++ b/src/trigger_actions.hpp
@@ -1,9 +1,10 @@
 #pragma once
 
-#include "interfaces/report_manager.hpp"
 #include "interfaces/trigger_action.hpp"
 #include "types/trigger_types.hpp"
 
+#include <boost/asio/io_context.hpp>
+
 namespace action
 {
 
@@ -44,7 +45,7 @@
 void fillActions(
     std::vector<std::unique_ptr<interfaces::TriggerAction>>& actionsIf,
     const std::vector<TriggerAction>& ActionsEnum, ::numeric::Type type,
-    double thresholdValue, interfaces::ReportManager& reportManager,
+    double thresholdValue, boost::asio::io_context& ioc,
     const std::shared_ptr<std::vector<std::string>>& reportIds);
 } // namespace numeric
 
@@ -83,7 +84,7 @@
 void fillActions(
     std::vector<std::unique_ptr<interfaces::TriggerAction>>& actionsIf,
     const std::vector<TriggerAction>& ActionsEnum,
-    ::discrete::Severity severity, interfaces::ReportManager& reportManager,
+    ::discrete::Severity severity, boost::asio::io_context& ioc,
     const std::shared_ptr<std::vector<std::string>>& reportIds);
 
 namespace onChange
@@ -110,8 +111,7 @@
 
 void fillActions(
     std::vector<std::unique_ptr<interfaces::TriggerAction>>& actionsIf,
-    const std::vector<TriggerAction>& ActionsEnum,
-    interfaces::ReportManager& reportManager,
+    const std::vector<TriggerAction>& ActionsEnum, boost::asio::io_context& ioc,
     const std::shared_ptr<std::vector<std::string>>& reportIds);
 } // namespace onChange
 
@@ -120,9 +120,9 @@
 class UpdateReport : public interfaces::TriggerAction
 {
   public:
-    UpdateReport(interfaces::ReportManager& reportManager,
+    UpdateReport(boost::asio::io_context& ioc,
                  std::shared_ptr<std::vector<std::string>> ids) :
-        reportManager(reportManager),
+        ioc(ioc),
         reportIds(std::move(ids))
     {}
 
@@ -130,7 +130,7 @@
                 double value) override;
 
   private:
-    interfaces::ReportManager& reportManager;
+    boost::asio::io_context& ioc;
     std::shared_ptr<std::vector<std::string>> reportIds;
 };
 } // namespace action
diff --git a/src/trigger_factory.cpp b/src/trigger_factory.cpp
index 04928df..da5a64c 100644
--- a/src/trigger_factory.cpp
+++ b/src/trigger_factory.cpp
@@ -14,10 +14,9 @@
 TriggerFactory::TriggerFactory(
     std::shared_ptr<sdbusplus::asio::connection> bus,
     std::shared_ptr<sdbusplus::asio::object_server> objServer,
-    SensorCache& sensorCache, interfaces::ReportManager& reportManager) :
+    SensorCache& sensorCache) :
     bus(std::move(bus)),
-    objServer(std::move(objServer)), sensorCache(sensorCache),
-    reportManager(reportManager)
+    objServer(std::move(objServer)), sensorCache(sensorCache)
 {}
 
 void TriggerFactory::updateDiscreteThresholds(
@@ -159,7 +158,7 @@
     std::string thresholdValue = thresholdParam.at_label<ts::ThresholdValue>();
 
     action::discrete::fillActions(actions, triggerActions, severity,
-                                  reportManager, reportIds);
+                                  bus->get_io_context(), reportIds);
 
     thresholds.emplace_back(std::make_shared<DiscreteThreshold>(
         bus->get_io_context(), sensors, std::move(actions),
@@ -182,7 +181,7 @@
     auto thresholdValue = double{thresholdParam.at_label<ts::ThresholdValue>()};
 
     action::numeric::fillActions(actions, triggerActions, type, thresholdValue,
-                                 reportManager, reportIds);
+                                 bus->get_io_context(), reportIds);
 
     thresholds.emplace_back(std::make_shared<NumericThreshold>(
         bus->get_io_context(), sensors, std::move(actions), dwellTime,
@@ -198,7 +197,7 @@
     std::vector<std::unique_ptr<interfaces::TriggerAction>> actions;
 
     action::discrete::onChange::fillActions(actions, triggerActions,
-                                            reportManager, reportIds);
+                                            bus->get_io_context(), reportIds);
 
     thresholds.emplace_back(
         std::make_shared<OnChangeThreshold>(sensors, std::move(actions)));
@@ -227,8 +226,7 @@
 
     return std::make_unique<Trigger>(
         bus->get_io_context(), objServer, id, name, triggerActions, reportIds,
-        std::move(thresholds), triggerManager, triggerStorage, *this, sensors,
-        reportManager);
+        std::move(thresholds), triggerManager, triggerStorage, *this, sensors);
 }
 
 Sensors TriggerFactory::getSensors(
diff --git a/src/trigger_factory.hpp b/src/trigger_factory.hpp
index 223efe0..40dfcfd 100644
--- a/src/trigger_factory.hpp
+++ b/src/trigger_factory.hpp
@@ -14,8 +14,7 @@
   public:
     TriggerFactory(std::shared_ptr<sdbusplus::asio::connection> bus,
                    std::shared_ptr<sdbusplus::asio::object_server> objServer,
-                   SensorCache& sensorCache,
-                   interfaces::ReportManager& reportManager);
+                   SensorCache& sensorCache);
 
     std::unique_ptr<interfaces::Trigger>
         make(const std::string& id, const std::string& name,
@@ -48,7 +47,6 @@
     std::shared_ptr<sdbusplus::asio::connection> bus;
     std::shared_ptr<sdbusplus::asio::object_server> objServer;
     SensorCache& sensorCache;
-    interfaces::ReportManager& reportManager;
 
     Sensors getSensors(
         const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const;
diff --git a/src/trigger_manager.cpp b/src/trigger_manager.cpp
index d581f71..3c06b11 100644
--- a/src/trigger_manager.cpp
+++ b/src/trigger_manager.cpp
@@ -174,19 +174,3 @@
         }
     }
 }
-
-std::vector<std::string>
-    TriggerManager::getTriggerIdsForReport(const std::string& reportId) const
-{
-    std::vector<std::string> result;
-    for (const auto& trigger : triggers)
-    {
-        const auto& reportIds = trigger->getReportIds();
-        if (std::find(reportIds.begin(), reportIds.end(), reportId) !=
-            reportIds.end())
-        {
-            result.emplace_back(trigger->getId());
-        }
-    }
-    return result;
-}
diff --git a/src/trigger_manager.hpp b/src/trigger_manager.hpp
index 2c76c3a..bbdba8e 100644
--- a/src/trigger_manager.hpp
+++ b/src/trigger_manager.hpp
@@ -27,9 +27,6 @@
 
     static void verifyReportIds(const std::vector<std::string>& newReportIds);
 
-    std::vector<std::string>
-        getTriggerIdsForReport(const std::string& reportId) const override;
-
   private:
     std::unique_ptr<interfaces::TriggerFactory> triggerFactory;
     std::unique_ptr<interfaces::JsonStorage> triggerStorage;
diff --git a/src/types/report_types.hpp b/src/types/report_types.hpp
index 42f1ab0..c0f7b39 100644
--- a/src/types/report_types.hpp
+++ b/src/types/report_types.hpp
@@ -36,9 +36,3 @@
 
 ReadingParameters
     toReadingParameters(const std::vector<LabeledMetricParameters>& labeled);
-
-enum class TriggerIdUpdate
-{
-    Add,
-    Remove
-};
diff --git a/src/utils/messanger.hpp b/src/utils/messanger.hpp
new file mode 100644
index 0000000..a2a2c22
--- /dev/null
+++ b/src/utils/messanger.hpp
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "messanger_service.hpp"
+
+#include <boost/asio.hpp>
+
+namespace utils
+{
+
+template <class Service>
+class MessangerT
+{
+  public:
+    explicit MessangerT(boost::asio::execution_context& execution_context) :
+        service_(boost::asio::use_service<Service>(execution_context)),
+        context_(service_.create())
+    {}
+
+    ~MessangerT()
+    {
+        service_.destroy(context_);
+    }
+
+    template <class EventType>
+    void on_receive(std::function<void(const EventType&)> handler)
+    {
+        context_.handlers.emplace_back(std::move(handler));
+    }
+
+    template <class EventType>
+    void send(const EventType& event)
+    {
+        service_.send(event);
+    }
+
+  private:
+    Service& service_;
+    typename Service::Context& context_;
+};
+
+using Messanger = MessangerT<MessangerService>;
+
+} // namespace utils
diff --git a/src/utils/messanger_service.cpp b/src/utils/messanger_service.cpp
new file mode 100644
index 0000000..e04de34
--- /dev/null
+++ b/src/utils/messanger_service.cpp
@@ -0,0 +1,28 @@
+#include "messanger_service.hpp"
+
+namespace utils
+{
+
+MessangerService::MessangerService(
+    boost::asio::execution_context& execution_context) :
+    boost::asio::execution_context::service(execution_context)
+{}
+
+MessangerService::Context& MessangerService::create()
+{
+    contexts_.emplace_back(std::make_unique<Context>());
+    return *contexts_.back();
+}
+
+void MessangerService::destroy(MessangerService::Context& context)
+{
+    contexts_.erase(std::remove_if(contexts_.begin(), contexts_.end(),
+                                   [&context](const auto& item) {
+                                       return item.get() == &context;
+                                   }),
+                    contexts_.end());
+}
+
+boost::asio::execution_context::id MessangerService::id = {};
+
+} // namespace utils
diff --git a/src/utils/messanger_service.hpp b/src/utils/messanger_service.hpp
new file mode 100644
index 0000000..86dd2ff
--- /dev/null
+++ b/src/utils/messanger_service.hpp
@@ -0,0 +1,53 @@
+#pragma once
+
+#include <boost/asio.hpp>
+
+#include <any>
+
+namespace utils
+{
+
+class MessangerService : public boost::asio::execution_context::service
+{
+  public:
+    using key_type = MessangerService;
+
+    struct Context
+    {
+        std::vector<std::any> handlers;
+    };
+
+    MessangerService(boost::asio::execution_context& execution_context);
+    ~MessangerService() = default;
+
+    void shutdown()
+    {}
+
+    Context& create();
+    void destroy(Context& context);
+
+    template <class T>
+    void send(const T& event)
+    {
+        using HandlerType = std::function<void(const T&)>;
+
+        for (const auto& context : contexts_)
+        {
+            for (const auto& any : context->handlers)
+            {
+                if (const HandlerType* handler =
+                        std::any_cast<HandlerType>(&any))
+                {
+                    (*handler)(event);
+                }
+            }
+        }
+    }
+
+    static boost::asio::execution_context::id id;
+
+  private:
+    std::vector<std::unique_ptr<Context>> contexts_;
+};
+
+} // namespace utils