Редис Салат Паблиш - PullRequest
       11

Редис Салат Паблиш

0 голосов
/ 18 декабря 2018

Я работаю над JDK 1.8 и не могу понять, почему не работает publish .Команда Redis « set » работает для данных.

<dependency>
    <groupId>io.lettuce</groupId>
    <artifactId>lettuce-core</artifactId>
    <version>5.0.1.RELEASE</version>
</dependency> 

Фрагмент кода:

RedisClient redisClient = RedisClient.create(redisURI);
connection = redisClient.connect();
String l_message = l_eventObject.toString();
connection.sync().publish(l_namespace, l_message);
connection.flushCommands(); // added this to see if this works

Отладочный выводиз журнала:

01:25:44.826 [Thread-3] DEBUG io.lettuce.core.RedisChannelHandler - dispatching command AsyncCommand [type=PUBLISH, output=IntegerOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command]

01:25:44.826 [Thread-3] DEBUG io.lettuce.core.protocol.DefaultEndpoint - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, epid=0x1] write() writeAndFlush command AsyncCommand [type=PUBLISH, output=IntegerOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command]

01:25:44.827 [Thread-3] DEBUG io.lettuce.core.protocol.DefaultEndpoint - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, epid=0x1] write() done

01:25:44.827 [lettuce-nioEventLoop-4-1] DEBUG io.lettuce.core.protocol.CommandHandler - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, chid=0x1] write(ctx, AsyncCommand [type=PUBLISH, output=IntegerOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command], promise)

01:25:44.829 [lettuce-nioEventLoop-4-1] DEBUG io.lettuce.core.protocol.CommandEncoder - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379] writing command AsyncCommand [type=PUBLISH, output=IntegerOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command]

01:25:44.830 [lettuce-nioEventLoop-4-1] DEBUG io.lettuce.core.protocol.CommandHandler - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, chid=0x1] Received: 4 bytes, 1 commands in the stack

01:25:44.831 [lettuce-nioEventLoop-4-1] DEBUG io.lettuce.core.protocol.CommandHandler - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, chid=0x1] Stack contains: 1 commands

01:25:44.831 [lettuce-nioEventLoop-4-1] DEBUG io.lettuce.core.protocol.RedisStateMachine - Decode AsyncCommand [type=PUBLISH, output=IntegerOutput [output=null, error='null'], commandType=io.lettuce.core.protocol.Command]

01:25:44.831 [lettuce-nioEventLoop-4-1] DEBUG io.lettuce.core.protocol.RedisStateMachine - Decoded AsyncCommand [type=PUBLISH, output=IntegerOutput [output=0, error='null'], commandType=io.lettuce.core.protocol.Command], empty stack: true

01:25:44.831 [Thread-3] DEBUG io.lettuce.core.protocol.DefaultEndpoint - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, epid=0x1] flushCommands()

01:25:44.831 [Thread-3] DEBUG io.lettuce.core.protocol.DefaultEndpoint - [channel=0xb75e3dc8, /10.1.1.202:59522 -> /10.1.1.44:6379, epid=0x1] flushCommands() Flushing 0 commands

1 Ответ

0 голосов
/ 20 декабря 2018

Возможное решение:

async.multi();
async.publish(l_namespace, l_message);
async.set(l_key, l_message); // for late subscribers to catch up
async.exec();
...