Example usage for io.netty.handler.codec.redis ArrayRedisMessage ArrayRedisMessage

List of usage examples for io.netty.handler.codec.redis ArrayRedisMessage ArrayRedisMessage

Introduction

In this page you can find the example usage for io.netty.handler.codec.redis ArrayRedisMessage ArrayRedisMessage.

Prototype

public ArrayRedisMessage(List<RedisMessage> children) 

Source Link

Document

Creates a ArrayRedisMessage for the given content .

Usage

From source file:com.flysoloing.learning.network.netty.redis.RedisClientHandler.java

License:Apache License

@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
    String[] commands = ((String) msg).split("\\s+");
    List<RedisMessage> children = new ArrayList<RedisMessage>(commands.length);
    for (String cmdString : commands) {
        children.add(new FullBulkStringRedisMessage(ByteBufUtil.writeUtf8(ctx.alloc(), cmdString)));
    }/*from   ww  w. j a  va  2 s .  c  o m*/
    RedisMessage request = new ArrayRedisMessage(children);
    ctx.write(request, promise);
}