Search in sources :

Example 6 with NettySimpleMessageHandler

use of com.ctrip.xpipe.netty.NettySimpleMessageHandler in project x-pipe by ctripcorp.

the class PsyncLatencyTest method startSendMessage.

private void startSendMessage() {
    EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
    Bootstrap b = new Bootstrap();
    b.group(eventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.TCP_NODELAY, true).handler(new ChannelInitializer<SocketChannel>() {

        @Override
        public void initChannel(SocketChannel ch) throws Exception {
            ChannelPipeline p = ch.pipeline();
            p.addLast(new LoggingHandler(LogLevel.DEBUG));
            p.addLast(new NettySimpleMessageHandler());
            p.addLast(new SetMessageHandler(PsyncLatencyTest.this));
        }
    });
    b.connect(master);
}
Also used : NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) SocketChannel(io.netty.channel.socket.SocketChannel) LoggingHandler(io.netty.handler.logging.LoggingHandler) EventLoopGroup(io.netty.channel.EventLoopGroup) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) SetMessageHandler(com.ctrip.xpipe.redis.keeper.simple.latency.netty.SetMessageHandler) Bootstrap(io.netty.bootstrap.Bootstrap) NettySimpleMessageHandler(com.ctrip.xpipe.netty.NettySimpleMessageHandler) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

NettySimpleMessageHandler (com.ctrip.xpipe.netty.NettySimpleMessageHandler)6 SocketChannel (io.netty.channel.socket.SocketChannel)6 LoggingHandler (io.netty.handler.logging.LoggingHandler)6 ChannelPipeline (io.netty.channel.ChannelPipeline)5 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)5 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)4 Bootstrap (io.netty.bootstrap.Bootstrap)3 EventLoopGroup (io.netty.channel.EventLoopGroup)2 IOException (java.io.IOException)2 CommandExecutionException (com.ctrip.xpipe.command.CommandExecutionException)1 XpipeException (com.ctrip.xpipe.exception.XpipeException)1 XpipeRuntimeException (com.ctrip.xpipe.exception.XpipeRuntimeException)1 RedisSlavePromotionException (com.ctrip.xpipe.redis.keeper.exception.RedisSlavePromotionException)1 CommandHandlerManager (com.ctrip.xpipe.redis.keeper.handler.CommandHandlerManager)1 NettyMasterHandler (com.ctrip.xpipe.redis.keeper.netty.NettyMasterHandler)1 ReceiveMessageHandler (com.ctrip.xpipe.redis.keeper.simple.latency.netty.ReceiveMessageHandler)1 SetMessageHandler (com.ctrip.xpipe.redis.keeper.simple.latency.netty.SetMessageHandler)1 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 ServerSocketChannel (io.netty.channel.socket.ServerSocketChannel)1 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)1