|
@@ -36,15 +36,18 @@ public class NettyClient {
|
|
@PostConstruct
|
|
@PostConstruct
|
|
public void connect() {
|
|
public void connect() {
|
|
EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
|
|
+ bootstrap.group(workerGroup);
|
|
|
|
+ bootstrap.channel(NioSocketChannel.class);
|
|
|
|
+ bootstrap.option(ChannelOption.AUTO_READ, true);
|
|
|
|
+
|
|
|
|
+
|
|
String[] connectInfoArr=Connectinfo.split(",");
|
|
String[] connectInfoArr=Connectinfo.split(",");
|
|
for (int i=0;i<connectInfoArr.length;i++){
|
|
for (int i=0;i<connectInfoArr.length;i++){
|
|
|
|
+
|
|
String ip= connectInfoArr[i].split(":")[2];
|
|
String ip= connectInfoArr[i].split(":")[2];
|
|
int port = Integer.valueOf(connectInfoArr[i].split(":")[3]);
|
|
int port = Integer.valueOf(connectInfoArr[i].split(":")[3]);
|
|
String projectId = connectInfoArr[i].split(":")[3]+"_"+connectInfoArr[i].split(":")[1];
|
|
String projectId = connectInfoArr[i].split(":")[3]+"_"+connectInfoArr[i].split(":")[1];
|
|
try {
|
|
try {
|
|
- bootstrap.group(workerGroup);
|
|
|
|
- bootstrap.channel(NioSocketChannel.class);
|
|
|
|
- bootstrap.option(ChannelOption.AUTO_READ, true);
|
|
|
|
bootstrap.handler(new CenterChannelInitializer(cloudKafkaConsumer,this,projectId,cloudKafkaProducer));
|
|
bootstrap.handler(new CenterChannelInitializer(cloudKafkaConsumer,this,projectId,cloudKafkaProducer));
|
|
ChannelFuture f = bootstrap.connect(ip, port).sync();
|
|
ChannelFuture f = bootstrap.connect(ip, port).sync();
|
|
channel = f.channel();
|
|
channel = f.channel();
|