1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.proxy.frontend.netty;
19
20 import io.netty.channel.ChannelInitializer;
21 import io.netty.channel.socket.SocketChannel;
22 import io.netty.handler.codec.protobuf.ProtobufDecoder;
23 import io.netty.handler.codec.protobuf.ProtobufEncoder;
24 import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
25 import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
26 import org.apache.shardingsphere.data.pipeline.cdc.protocol.request.CDCRequest;
27
28
29
30
31 public final class CDCServerHandlerInitializer extends ChannelInitializer<SocketChannel> {
32
33 @Override
34 protected void initChannel(final SocketChannel channel) {
35 channel.pipeline().addLast(new ProtobufVarint32FrameDecoder());
36 channel.pipeline().addLast(new ProtobufDecoder(CDCRequest.getDefaultInstance()));
37 channel.pipeline().addLast(new ProtobufVarint32LengthFieldPrepender());
38 channel.pipeline().addLast(new ProtobufEncoder());
39 channel.pipeline().addLast(new CDCChannelInboundHandler());
40 }
41 }