6#include <userver/concurrent/async_event_channel.hpp>
7#include <userver/engine/single_consumer_event.hpp>
8#include <userver/engine/task/task_with_result.hpp>
10USERVER_NAMESPACE_BEGIN
26 explicit ConflatedEventChannel(std::string name, OnRemoveCallback on_listener_removal = {});
27 ~ConflatedEventChannel() override;
30 template <
typename... Args>
31 void AddChannel(concurrent::AsyncEventSource<Args...>& channel);
37 template <
typename Class>
38 concurrent::AsyncEventSubscriberScope
UpdateAndListen(Class* obj, std::string_view name,
void (Class::*func)());
43 template <
typename... Args>
44 void OnChannelEvent(Args...);
46 std::atomic<
bool> stop_flag_;
47 engine::TaskWithResult<
void> task_;
48 std::vector<concurrent::AsyncEventSubscriberScope> subscriptions_;
49 engine::SingleConsumerEvent event_;
52template <
typename... Args>
57template <
typename Class>
60 std::string_view name,
63 return DoUpdateAndListen(obj, name, func, [&] { (obj->*func)(); });
66template <
typename... Args>