Search in sources :

Example 1 with ReceiveMessageHandler

use of com.ctrip.xpipe.redis.keeper.simple.latency.netty.ReceiveMessageHandler in project x-pipe by ctripcorp.

the class PsyncLatencyTest method startGetLatency.

private void startGetLatency() {
    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 ReceiveMessageHandler(runId, offset));
        }
    });
    b.connect(dest);
}
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) Bootstrap(io.netty.bootstrap.Bootstrap) NettySimpleMessageHandler(com.ctrip.xpipe.netty.NettySimpleMessageHandler) ReceiveMessageHandler(com.ctrip.xpipe.redis.keeper.simple.latency.netty.ReceiveMessageHandler) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

NettySimpleMessageHandler (com.ctrip.xpipe.netty.NettySimpleMessageHandler)1 ReceiveMessageHandler (com.ctrip.xpipe.redis.keeper.simple.latency.netty.ReceiveMessageHandler)1 Bootstrap (io.netty.bootstrap.Bootstrap)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 EventLoopGroup (io.netty.channel.EventLoopGroup)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)1 LoggingHandler (io.netty.handler.logging.LoggingHandler)1