Logo RedisPubSub Project   v0.9.0
RedisPubSub is an utility with Publisher/Subscirber model based on Redis for J-PARC/MLF.
RedisPublisher Class Reference

Publisher using Redis Publisher/Subscriber Package. More...

#include <RedisPubSub.h>

Collaboration diagram for RedisPublisher:

Public Member Functions

 RedisPublisher ()
 Default constructor. More...
 
 RedisPublisher (const string &host, int32_t port=6379)
 Constructor. More...
 
 ~RedisPublisher ()
 Destructor. More...
 
int32_t init ()
 Initialize publisher and connect to broker. More...
 
int32_t publish (const string &name, const char *src_buf, int32_t size)
 Publish data to the Redis server. More...
 

Private Attributes

string m_host
 
int32_t m_port
 Host IP address. More...
 
std::shared_ptr< redisContext > m_context
 Port number. More...
 

Detailed Description

Publisher using Redis Publisher/Subscriber Package.

RedisPublisher() publishes data in Redis server(broker).

Constructor & Destructor Documentation

RedisPublisher::RedisPublisher ( )

Default constructor.

RedisPublisher::RedisPublisher ( const string &  host,
int32_t  port = 6379 
)

Constructor.

Parameters
[in]hostHost IP address of the broker.
[in]portPort number of the broker.
RedisPublisher::~RedisPublisher ( )

Destructor.

Member Function Documentation

int32_t RedisPublisher::init ( )

Initialize publisher and connect to broker.

Return values
0Success
-1Redis context was not allocated
-2Redis context has some error condition

Here is the caller graph for this function:

int32_t RedisPublisher::publish ( const string &  name,
const char *  src_buf,
int32_t  size 
)

Publish data to the Redis server.

Parameters
[in]nameName of data
[in]src_bufSource buffer with data inside
[in]sizeSize of data
Return values
n(>=0)number of clients that received the data
-1no Redis context(empty)
-2redisCommand was not executed correctly
-3redisCommand error

Here is the caller graph for this function:

Field Documentation

std::shared_ptr<redisContext> RedisPublisher::m_context
private

Port number.

Redis context

string RedisPublisher::m_host
private
int32_t RedisPublisher::m_port
private

Host IP address.


The documentation for this class was generated from the following files: