OCT 提交redis

This commit is contained in:
wuhuanzheng 2019-06-26 16:14:31 +08:00
parent 99d2d892b6
commit b560f74399
11 changed files with 3157 additions and 7 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
#include "redisMq.h"
int main(int argc, char *argv[])
{
bool ret = redisPubInit();
if (!ret)
{
printf("Init failed.\n");
return 0;
}
ret = redisPubConnect();
if (!ret)
{
printf("connect failed.");
return 0;
}
//while (true)
{
//redisPublish("test-channel", "Test message");
sleep(1);
}
redisPubDisconnect();
redisPubUninit();
return 0;
}

View File

@ -0,0 +1,39 @@
#include "redisMq.h"
void test_func_recv(struct RecvMsg_t *msg)
{
if (msg->msg)
{
printf("%s,%d,%llu,%s,%d\n", __FUNCTION__, __LINE__, pthread_self(), msg->msg, msg->len);
freeMsg(msg);
}
}
int main(int argc, char *argv[])
{
bool ret = redisSubInit();
if (!ret)
{
printf("Init failed.\n");
return 0;
}
redisRegisterChannelFunc("test-channel",test_func_recv);
ret = redisSubConnect();
if (!ret)
{
printf("Connect failed.\n");
return 0;
}
redisSubscriber("test-channel");
while (true)
{
sleep(1);
}
redisSubDisconnect();
redisSubUninit();
return 0;
}

View File

@ -1,7 +0,0 @@
#ifndef __REDIS_CHANNRL_H_
#define __REDIS_CHANNRL_H_
/* 建议 命名按照 redis_chan_模块名_功能*/
#define REDIS_CHAN_REDISMQ_TEST ("redis_chan_redismq_test")
#endif