本文整理汇总了Java中org.redisson.api.RTopic类的典型用法代码示例。如果您正苦于以下问题:Java RTopic类的具体用法?Java RTopic怎么用?Java RTopic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RTopic类属于org.redisson.api包,在下文中一共展示了RTopic类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: send
点赞 3
import org.redisson.api.RTopic; //导入依赖的package包/类
@Override
public void send() {
if (redissonClient.isShutdown() || redissonClient.isShuttingDown()) {
return;
}
if (to instanceof QueueMessageSubject) {
queueConsumer.accept(((QueueMessageSubject) to).getQueueName());
}
if (to instanceof MultipleQueueMessageSubject) {
((MultipleQueueMessageSubject) to).getQueueName().forEach(queueConsumer);
}
if (to instanceof TopicMessageSubject) {
RTopic<Message> topic = redissonClient.getTopic("topic_" + ((TopicMessageSubject) to).getTopic(), codec);
topic.publish(message);
}
}
开发者ID:hs-web,
项目名称:hsweb-framework,
代码行数:17,
代码来源:RedissonMessagePublish.java
示例2: writeImpl
点赞 3
import org.redisson.api.RTopic; //导入依赖的package包/类
@Override
protected void writeImpl(PacketFuture pf) throws Exception {
InsPacket packet = pf.send();
packet.type(InsPacket.Type.GROUP.ordinal());
ByteBuffer bytes = codec(packet.version()).encode(packet);
String topic = packet.ins().toGroup().name();
List<Co> toCo = packet.ins().toCo();
if (toCo.isEmpty()) {
RTopic<byte[]> groupTopic = redisson.getTopic(topic, ByteArrayCodec.INSTANCE);
groupTopic.publish(bytes.array());
} else {
for (Co co : toCo) {
RTopic<byte[]> coTopic = redisson.getTopic(String.valueOf(co.hashCode()), ByteArrayCodec.INSTANCE);
coTopic.publish(bytes.array());
}
}
pf.result(new PacketResult(PacketResult.IOSt.SEND_SUCC));
}
开发者ID:dzh,
项目名称:coca,
代码行数:20,
代码来源:RedisGroupChannel.java
示例3: main
点赞 3
import org.redisson.api.RTopic; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
CountDownLatch latch = new CountDownLatch(1);
RTopic<String> topic = redisson.getTopic("topic2");
topic.addListener(new MessageListener<String>() {
@Override
public void onMessage(String channel, String msg) {
latch.countDown();
}
});
topic.publish("msg");
latch.await();
redisson.shutdown();
}
开发者ID:redisson,
项目名称:redisson-examples,
代码行数:20,
代码来源:TopicExamples.java