#include <userver/storages/redis/subscription_token.hpp>
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.
Public Types | |
using | OnMessageCb |
using | OnPmessageCb |
Public Member Functions | |
SubscriptionToken (SubscriptionToken &&) noexcept | |
SubscriptionToken (std::unique_ptr< impl::SubscriptionTokenImplBase > &&implementation) | |
SubscriptionToken & | operator= (SubscriptionToken &&) noexcept |
void | SetMaxQueueLength (size_t length) |
void | Unsubscribe () |
bool | IsEmpty () const noexcept |
using storages::redis::SubscriptionToken::OnMessageCb |
Definition at line 48 of file subscription_token.hpp.
using storages::redis::SubscriptionToken::OnPmessageCb |
Definition at line 50 of file subscription_token.hpp.
storages::redis::SubscriptionToken::SubscriptionToken | ( | std::unique_ptr< impl::SubscriptionTokenImplBase > && | implementation | ) |
This constructor can be used in tests/mocks to create your own subscription token
|
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 work correctly on empty tokens.
Definition at line 77 of file subscription_token.hpp.
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.
void storages::redis::SubscriptionToken::Unsubscribe | ( | ) |
Unsubscribe from the channel. This method is synchronous, once it returned, no new calls to callback will be made.