RAII subscription guard, that is usually retrieved from storages::redis::SubscribeClient.
More...
#include <userver/storages/redis/subscription_token.hpp>
|
using | OnMessageCb = std::function< void(const std::string &channel, const std::string &message)> |
|
using | OnPmessageCb = std::function< void(const std::string &pattern, const std::string &channel, const std::string &message)> |
|
RAII subscription guard, that is usually retrieved from storages::redis::SubscribeClient.
See storages::redis::MockSubscriptionTokenImpl for hints on mocking and testing.
Definition at line 46 of file subscription_token.hpp.
◆ OnMessageCb
using storages::redis::SubscriptionToken::OnMessageCb = std::function<void(const std::string& channel, const std::string& message)> |
◆ OnPmessageCb
using storages::redis::SubscriptionToken::OnPmessageCb = std::function<void(const std::string& pattern, const std::string& channel, const std::string& message)> |
◆ SubscriptionToken()
storages::redis::SubscriptionToken::SubscriptionToken |
( |
std::unique_ptr< impl::SubscriptionTokenImplBase > && |
implementation | ) |
|
This constructor can be used in tests/mocks to create your own subscription token
◆ IsEmpty()
bool storages::redis::SubscriptionToken::IsEmpty |
( |
| ) |
const |
|
inlinenoexcept |
Checks that token is not empty. Empty token has no implementation inside. This method is mostly useful in unit tests. All methods of this class works correctly on empty tokens.
Definition at line 77 of file subscription_token.hpp.
◆ SetMaxQueueLength()
void storages::redis::SubscriptionToken::SetMaxQueueLength |
( |
size_t |
length | ) |
|
There is a MPSC queue inside the connection. This parameter requlates its maximum length. If it overflows, new messages are discarded.
◆ Unsubscribe()
void storages::redis::SubscriptionToken::Unsubscribe |
( |
| ) |
|
Unsubscribe from the channel. This method is synchronous, once it returned, no new calls to callback will be made.
The documentation for this class was generated from the following file: