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,
27 OnRemoveCallback on_listener_removal = {});
28 ~ConflatedEventChannel() override;
31 template <
typename... Args>
38 template <
typename Class>
40 std::string_view name,
41 void (Class::*func)());
46 template <
typename... Args>
47 void OnChannelEvent(Args...);
49 std::atomic<
bool> stop_flag_;
51 std::vector<concurrent::AsyncEventSubscriberScope> subscriptions_;
52 engine::SingleConsumerEvent event_;
55template <
typename... Args>
57 concurrent::AsyncEventSource<Args...>& channel) {
58 subscriptions_.push_back(channel.AddListener(
59 this, Name(), &ConflatedEventChannel::OnChannelEvent<Args...>));
62template <
typename Class>
64 Class* obj, std::string_view name,
void (Class::*func)()) {
65 return DoUpdateAndListen(obj, name, func, [&] { (obj->*func)(); });
68template <
typename... Args>