32 #include "hiredis/hiredis.h"
59 freeReplyObject(reply);
103 int32_t
publish(
const string& name,
const char* src_buf, int32_t size);
135 void setHost(
const string& host, int32_t port);
202 int32_t
get(
string& name,
char* target_buf, int32_t& size,
203 int32_t timeout = 2000);
215 int32_t
getChannels(
string name, vector<string>& vec);
219 #endif // REDISPUBSUB_H
int32_t publish(const string &name, const char *src_buf, int32_t size)
Publish data to the Redis server.
Definition: RedisPubSub.cpp:63
Redis context deleter using Redis Publisher/Subscriber Package.
Definition: RedisPubSub.h:44
int32_t getChannels(string name, vector< string > &vec)
Get name of channels from the Redis broker (sync).
Definition: RedisPubSub.cpp:225
Synchronous subscriber using Redis Publisher/Subscriber Package.
Definition: RedisPubSub.h:144
std::shared_ptr< redisContext > m_context
Port number.
Definition: RedisPubSub.h:71
int32_t subscribe(const string &name)
Subscribe data from the Redis broker (sync).
Definition: RedisPubSub.cpp:139
int32_t m_port
Host IP address.
Definition: RedisPubSub.h:115
int32_t unsubscribe(const string &name)
Unsubscribe data from the Redis broker (sync).
Definition: RedisPubSub.cpp:158
string m_host
Definition: RedisPubSub.h:114
void operator()(redisContext *context)
Definition: RedisPubSub.h:46
virtual ~RedisSyncSubscriber()
Destructor.
Definition: RedisPubSub.cpp:117
RedisSyncSubscriber()
Default constructor.
Definition: RedisPubSub.cpp:108
string m_host
Definition: RedisPubSub.h:69
void operator()(redisReply *reply)
Definition: RedisPubSub.h:58
std::shared_ptr< redisContext > m_context
Port number.
Definition: RedisPubSub.h:116
virtual ~RedisSubscriber()
Destructor.
Definition: RedisPubSub.cpp:104
Subscriber using Redis Publisher/Subscriber Package.
Definition: RedisPubSub.h:111
RedisPublisher()
Default constructor.
Definition: RedisPubSub.cpp:27
int32_t init()
Initialize subscriber as synchronous mode and connect to the broker.
Definition: RedisPubSub.cpp:121
int32_t init()
Initialize publisher and connect to broker.
Definition: RedisPubSub.cpp:43
void setHost(const string &host, int32_t port)
Set host address of the broker.
Definition: RedisPubSub.cpp:98
Publisher using Redis Publisher/Subscriber Package.
Definition: RedisPubSub.h:67
Redis reply object deleter using Redis Publisher/Subscriber Package.
Definition: RedisPubSub.h:56
RedisSubscriber()
Redis context.
Definition: RedisPubSub.cpp:89
int32_t m_port
Host IP address.
Definition: RedisPubSub.h:70
~RedisPublisher()
Destructor.
Definition: RedisPubSub.cpp:39