9#include <userver/storages/redis/client_fwd.hpp>
10#include <userver/storages/redis/impl/base.hpp>
11#include <userver/storages/redis/impl/wait_connected_mode.hpp>
13#include <userver/storages/redis/subscription_token.hpp>
15USERVER_NAMESPACE_BEGIN
18class SubscribeSentinel;
44 virtual ~SubscribeClient();
46 virtual SubscriptionToken Subscribe(
47 std::string channel, SubscriptionToken::OnMessageCb on_message_cb,
48 const USERVER_NAMESPACE::redis::
CommandControl& command_control) = 0;
50 SubscriptionToken Subscribe(std::string channel,
51 SubscriptionToken::OnMessageCb on_message_cb) {
52 return Subscribe(std::move(channel), std::move(on_message_cb), {});
55 virtual SubscriptionToken Psubscribe(
56 std::string pattern, SubscriptionToken::OnPmessageCb on_pmessage_cb,
57 const USERVER_NAMESPACE::redis::
CommandControl& command_control) = 0;
59 virtual size_t ShardsCount()
const = 0;
60 virtual bool IsInClusterMode()
const = 0;
62 SubscriptionToken Psubscribe(std::string pattern,
63 SubscriptionToken::OnPmessageCb on_pmessage_cb) {
64 return Psubscribe(std::move(pattern), std::move(on_pmessage_cb), {});
67 virtual SubscriptionToken Ssubscribe(
68 std::string channel, SubscriptionToken::OnMessageCb on_message_cb,
69 const USERVER_NAMESPACE::redis::
CommandControl& command_control) = 0;
71 SubscriptionToken Ssubscribe(std::string channel,
72 SubscriptionToken::OnMessageCb on_message_cb) {
73 return Ssubscribe(std::move(channel), std::move(on_message_cb), {});