diff --git a/README.md b/README.md index 86ef8755..c28fc0ea 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,6 @@
- -

最新更新

-
    -
  1. canal QQ讨论群已经建立,群号:161559791 ,欢迎加入进行技术讨论。
  2. -
  3. canal消费端项目开源: Otter(分布式数据库同步系统),地址:https://github.com/alibaba/otter
  4. -
  5. Canal已在阿里云推出商业化版本 数据传输服务DTS, 开通即用,免去部署维护的昂贵使用成本。DTS针对阿里云RDS、DRDS等产品进行了适配,解决了Binlog日志回收,主备切换、VPC网络切换等场景下的订阅高可用问题。同时,针对RDS进行了针对性的性能优化。出于稳定性、性能及成本的考虑,强烈推荐阿里云用户使用DTS产品。DTS产品使用文档
  6. -DTS支持阿里云RDS&DRDS的Binlog日志实时订阅,现推出首月免费体验,限时限量,立即体验>>> -
- +

背景

早期,阿里巴巴B2B公司因为存在杭州和美国双机房部署,存在跨机房同步的业务需求。不过早期的数据库同步业务,主要是基于trigger的方式获取增量变更,不过从2010年开始,阿里系公司开始逐步的尝试基于数据库的日志解析,获取增量变更进行同步,由此衍生出了增量订阅&消费的业务,从此开启了一段新纪元。

ps. 目前内部版本已经支持mysql和oracle部分版本的日志解析,当前的canal开源版本支持5.7及以下的版本(阿里内部mysql 5.7.13, 5.6.10, mysql 5.5.18和5.1.40/48)

@@ -46,24 +38,54 @@ DTS支持阿里云RDS&DRDS的Binlog日志实时订阅,现推出首月免费体
  • canal解析binary log对象(原始为byte流)
  • +

    重要版本更新说明

    + +canal 1.1.x系列,参考release文档:版本发布信息 + +1. 整体性能测试&优化,提升了150%. #726 参考: 【[Performance](https://github.com/alibaba/canal/wiki/Performance)】 +2. 原生支持prometheus监控 #765 【[Prometheus QuickStart](https://github.com/alibaba/canal/wiki/Prometheus-QuickStart)】 +3. 原生支持kafka消息投递 #695 【[Canal Kafka QuickStart](https://github.com/alibaba/canal/wiki/Canal-Kafka-QuickStart)】 +4. 原生支持aliyun rds的binlog订阅 (解决自动主备切换/oss binlog离线解析) 参考: 【[Aliyun RDS QuickStart](https://github.com/alibaba/canal/wiki/aliyun-RDS-QuickStart)】 +5. 原生支持docker镜像 #801 参考: 【[Docker QuickStart](https://github.com/alibaba/canal/wiki/Docker-QuickStart)】 +

    相关文档

    See the wiki page for : wiki文档

    wiki文档列表

    +

    多语言业务

    + +1. canal整体交互协议设计上使用了protobuf3.0,理论上可以支持绝大部分的多语言场景,欢迎大家提交多客户端的PR + * canal java客户端: https://github.com/alibaba/canal/wiki/ClientExample + * canal c#客户端开源项目地址: https://github.com/CanalSharp/CanalSharp + * canal go客户端,开发进行中 +2. canal作为MySQL binlog的增量获取工具,可以将数据投递到MQ系统中,比如Kafka/RocketMQ,可以借助于MQ的多语言能力 +

    相关资料

    * ADC阿里技术嘉年华分享ppt (放在google docs上,可能需要翻墙): ppt下载 @@ -91,9 +113,13 @@ See the wiki page for : wiki文
  • 报告issue:issues
  • -
    -【招聘】阿里巴巴中间件团队招聘JAVA高级工程师
    -岗位主要为技术型内容(非业务部门),阿里中间件整个体系对于未来想在技术上有所沉淀的同学还是非常有帮助的
    -工作地点:杭州、北京均可. ps. 阿里待遇向来都是不错的,有意者可以QQ、微博私聊. 
    -具体招聘内容:https://job.alibaba.com/zhaopin/position_detail.htm?positionId=32666
    -
    +

    最新更新

    +
      +
    1. canal发布重大版本更新1.1.0,具体releaseNode参考:https://github.com/alibaba/canal/releases/tag/canal-1.1.0
    2. +
    3. canal c#客户端开源项目地址: https://github.com/CanalSharp/CanalSharp ,推荐!
    4. +
    5. canal QQ讨论群已经建立,群号:161559791 ,欢迎加入进行技术讨论。
    6. +
    7. canal消费端项目开源: Otter(分布式数据库同步系统),地址:https://github.com/alibaba/otter
    8. + +
    9. Canal已在阿里云推出商业化版本 数据传输服务DTS, 开通即用,免去部署维护的昂贵使用成本。DTS针对阿里云RDS、DRDS等产品进行了适配,解决了Binlog日志回收,主备切换、VPC网络切换等场景下的订阅高可用问题。同时,针对RDS进行了针对性的性能优化。出于稳定性、性能及成本的考虑,强烈推荐阿里云用户使用DTS产品。DTS产品使用文档
    10. +DTS支持阿里云RDS&DRDS的Binlog日志实时订阅,现推出首月免费体验,限时限量,立即体验>>> +
    \ No newline at end of file diff --git a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/CanalOuterAdapter.java b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/CanalOuterAdapter.java index 53368472..0871eb74 100644 --- a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/CanalOuterAdapter.java +++ b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/CanalOuterAdapter.java @@ -1,7 +1,9 @@ package com.alibaba.otter.canal.client.adapter; import com.alibaba.otter.canal.client.adapter.support.CanalOuterAdapterConfiguration; +import com.alibaba.otter.canal.client.adapter.support.Dml; import com.alibaba.otter.canal.client.adapter.support.SPI; +import com.alibaba.otter.canal.protocol.FlatMessage; import com.alibaba.otter.canal.protocol.Message; /** @@ -23,9 +25,11 @@ public interface CanalOuterAdapter { /** * 往适配器中写入数据 * - * @param message message数据包 + * @param dml 数据包 */ - void writeOut(Message message); + void writeOut(Dml dml); + + // void writeOut(FlatMessage flatMessage); /** * 外部适配器销毁接口 diff --git a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/CanalClientConfig.java b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/CanalClientConfig.java index 6619555c..493d902a 100644 --- a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/CanalClientConfig.java +++ b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/CanalClientConfig.java @@ -22,6 +22,9 @@ public class CanalClientConfig { private List mqTopics; + private Boolean flatMessage = true; + + private List canalInstances; public String getCanalServerHost() { @@ -60,6 +63,14 @@ public class CanalClientConfig { return mqTopics; } + public Boolean getFlatMessage() { + return flatMessage; + } + + public void setFlatMessage(Boolean flatMessage) { + this.flatMessage = flatMessage; + } + public void setMqTopics(List mqTopics) { this.mqTopics = mqTopics; } @@ -166,25 +177,6 @@ public class CanalClientConfig { this.outAdapters = outAdapters; } - // public List getAdapters() { - // return adapters; - // } - // - // public void setAdapters(List adapters) { - // this.adapters = adapters; - // } } - // public static class Adaptor { - // private List outAdapters; - // - // public List getOutAdapters() { - // return outAdapters; - // } - // - // public void setOutAdapters(List outAdapters) - // { - // this.outAdapters = outAdapters; - // } - // } } diff --git a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/JdbcTypeUtil.java b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/JdbcTypeUtil.java index fd65589f..777770ef 100644 --- a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/JdbcTypeUtil.java +++ b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/JdbcTypeUtil.java @@ -21,7 +21,7 @@ public class JdbcTypeUtil { private static Logger logger = LoggerFactory.getLogger(JdbcTypeUtil.class); - public static Object typeConvert(String tableName, String columnName, String value, int sqlType, String mysqlType) { + public static Object typeConvert(String columnName, String value, int sqlType, String mysqlType) { if (value == null || value.equals("")) { return null; } @@ -96,7 +96,7 @@ public class JdbcTypeUtil { } return res; } catch (Exception e) { - logger.error("table: {} column: {}, failed convert type {} to {}", tableName, columnName, value, sqlType); + logger.error("table: {} column: {}, failed convert type {} to {}", columnName, value, sqlType); return value; } } diff --git a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MessageUtil.java b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MessageUtil.java index 7f3722f1..4765ec30 100644 --- a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MessageUtil.java +++ b/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MessageUtil.java @@ -3,6 +3,7 @@ package com.alibaba.otter.canal.client.adapter.support; import java.util.*; import com.alibaba.otter.canal.protocol.CanalEntry; +import com.alibaba.otter.canal.protocol.FlatMessage; import com.alibaba.otter.canal.protocol.Message; /** @@ -63,8 +64,7 @@ public class MessageUtil { for (CanalEntry.Column column : columns) { row.put(column.getName(), - JdbcTypeUtil.typeConvert(dml.getTable(), - column.getName(), + JdbcTypeUtil.typeConvert(column.getName(), column.getValue(), column.getSqlType(), column.getMysqlType())); @@ -82,8 +82,7 @@ public class MessageUtil { for (CanalEntry.Column column : rowData.getBeforeColumnsList()) { if (updateSet.contains(column.getName())) { rowOld.put(column.getName(), - JdbcTypeUtil.typeConvert(dml.getTable(), - column.getName(), + JdbcTypeUtil.typeConvert(column.getName(), column.getValue(), column.getSqlType(), column.getMysqlType())); @@ -106,6 +105,57 @@ public class MessageUtil { } } + public static Dml flatMessage2Dml(FlatMessage flatMessage) { + if (flatMessage == null) { + return null; + } + Dml dml = new Dml(); + dml.setDatabase(flatMessage.getDatabase()); + dml.setTable(flatMessage.getTable()); + dml.setType(flatMessage.getType()); + dml.setTs(flatMessage.getTs()); + dml.setSql(flatMessage.getSql()); + if (flatMessage.getSqlType() == null || flatMessage.getMysqlType() == null) { + throw new RuntimeException("SqlType or mysqlType is null"); + } + List> data = flatMessage.getData(); + if (data != null) { + dml.setData(changeRows(data, flatMessage.getSqlType(), flatMessage.getMysqlType())); + } + List> old = flatMessage.getOld(); + if (old != null) { + dml.setOld(changeRows(old, flatMessage.getSqlType(), flatMessage.getMysqlType())); + } + return dml; + } + + private static List> changeRows(List> rows, Map sqlTypes, + Map mysqlTypes) { + List> result = new ArrayList<>(); + for (Map row : rows) { + Map resultRow = new LinkedHashMap<>(); + for (Map.Entry entry : row.entrySet()) { + String columnName = entry.getKey(); + String columnValue = entry.getValue(); + + Integer sqlType = sqlTypes.get(columnName); + if (sqlType == null) { + continue; + } + + String mysqlType = mysqlTypes.get(columnName); + if (mysqlType == null) { + continue; + } + + Object finalValue = JdbcTypeUtil.typeConvert(columnName, columnValue, sqlType, mysqlType); + resultRow.put(columnName, finalValue); + } + result.add(resultRow); + } + return result; + } + public interface Consumer { void accept(T t); diff --git a/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/HbaseAdapter.java b/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/HbaseAdapter.java index 03103b8b..bbd8fb1c 100644 --- a/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/HbaseAdapter.java +++ b/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/HbaseAdapter.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import com.alibaba.otter.canal.protocol.FlatMessage; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; @@ -86,20 +87,14 @@ public class HbaseAdapter implements CanalOuterAdapter { } @Override - public void writeOut(Message message) { - MessageUtil.parse4Dml(message, new MessageUtil.Consumer() { - - @Override - public void accept(Dml dml) { - if (dml == null) { - return; - } - String database = dml.getDatabase(); - String table = dml.getTable(); - MappingConfig config = mappingConfigCache.get(database + "-" + table); - hbaseSyncService.sync(config, dml); - } - }); + public void writeOut(Dml dml) { + if (dml == null) { + return; + } + String database = dml.getDatabase(); + String table = dml.getTable(); + MappingConfig config = mappingConfigCache.get(database + "-" + table); + hbaseSyncService.sync(config, dml); } @Override diff --git a/client-adapter/logger/src/main/java/com/alibaba/otter/canal/client/adapter/logger/LoggerAdapterExample.java b/client-adapter/logger/src/main/java/com/alibaba/otter/canal/client/adapter/logger/LoggerAdapterExample.java index c6c1cb44..c72a0ee0 100644 --- a/client-adapter/logger/src/main/java/com/alibaba/otter/canal/client/adapter/logger/LoggerAdapterExample.java +++ b/client-adapter/logger/src/main/java/com/alibaba/otter/canal/client/adapter/logger/LoggerAdapterExample.java @@ -6,9 +6,7 @@ import org.slf4j.LoggerFactory; import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; import com.alibaba.otter.canal.client.adapter.support.CanalOuterAdapterConfiguration; import com.alibaba.otter.canal.client.adapter.support.Dml; -import com.alibaba.otter.canal.client.adapter.support.MessageUtil; import com.alibaba.otter.canal.client.adapter.support.SPI; -import com.alibaba.otter.canal.protocol.Message; /** * 外部适配器示例 @@ -22,20 +20,13 @@ public class LoggerAdapterExample implements CanalOuterAdapter { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Override - public void writeOut(Message message) { - // 直接输出日志信息 - MessageUtil.parse4Dml(message, new MessageUtil.Consumer() { + public void init(CanalOuterAdapterConfiguration configuration) { - @Override - public void accept(Dml dml) { - logger.info(dml.toString()); - } - }); } @Override - public void init(CanalOuterAdapterConfiguration configuration) { - + public void writeOut(Dml dml) { + logger.info(dml.toString()); } @Override diff --git a/client-launcher/src/main/bin/startup.sh b/client-launcher/src/main/bin/startup.sh index d467b4d2..0e09ddff 100644 --- a/client-launcher/src/main/bin/startup.sh +++ b/client-launcher/src/main/bin/startup.sh @@ -74,7 +74,7 @@ else fi JAVA_OPTS=" $JAVA_OPTS -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8" -CANAL_OPTS="-DappName=otter-canal -Dlogback.configurationFile=$logback_configurationFile -Dcanal.conf=$canal_conf" +CANAL_OPTS="-DappName=otter-canal-client -Dlogback.configurationFile=$logback_configurationFile -Dcanal.conf=$canal_conf" if [ -e $canal_conf -a -e $logback_configurationFile ] then diff --git a/client-launcher/src/main/bin/stop.sh b/client-launcher/src/main/bin/stop.sh index 0cfcc712..c96f2807 100644 --- a/client-launcher/src/main/bin/stop.sh +++ b/client-launcher/src/main/bin/stop.sh @@ -45,7 +45,7 @@ fi pid=`cat $pidfile` if [ "$pid" == "" ] ; then - pid=`get_pid "appName=otter-canal"` + pid=`get_pid "appName=otter-canal-client"` fi echo -e "`hostname`: stopping canal $pid ... " @@ -54,7 +54,7 @@ kill $pid LOOPS=0 while (true); do - gpid=`get_pid "appName=otter-canal" "$pid"` + gpid=`get_pid "appName=otter-canal-client" "$pid"` if [ "$gpid" == "" ] ; then echo "Oook! cost:$LOOPS" `rm $pidfile` diff --git a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/AbstractCanalAdapterWorker.java b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/AbstractCanalAdapterWorker.java index 8382d0a3..0dde5211 100644 --- a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/AbstractCanalAdapterWorker.java +++ b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/AbstractCanalAdapterWorker.java @@ -7,10 +7,13 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; +import com.alibaba.otter.canal.client.adapter.support.Dml; +import com.alibaba.otter.canal.client.adapter.support.MessageUtil; +import com.alibaba.otter.canal.protocol.FlatMessage; import com.alibaba.otter.canal.protocol.Message; /** @@ -47,9 +50,16 @@ public abstract class AbstractCanalAdapterWorker { public Boolean call() { try { // 组内适配器穿行运行,尽量不要配置组内适配器 - for (CanalOuterAdapter c : adapters) { + for (final CanalOuterAdapter c : adapters) { long begin = System.currentTimeMillis(); - c.writeOut(message); + MessageUtil.parse4Dml(message, new MessageUtil.Consumer() { + + @Override + public void accept(Dml dml) { + c.writeOut(dml); + } + }); + if (logger.isDebugEnabled()) { logger.debug("{} elapsed time: {}", c.getClass().getName(), @@ -71,7 +81,49 @@ public abstract class AbstractCanalAdapterWorker { logger.error("Outer adapter write failed"); } } catch (InterruptedException | ExecutionException e) { - logger.error(e.getMessage(), e); + // ignore + } + } + } + } + + protected void writeOut(final FlatMessage flatMessage) { + List> futures = new ArrayList<>(); + // 组间适配器并行运行 + for (List outerAdapters : canalOuterAdapters) { + final List adapters = outerAdapters; + futures.add(groupInnerExecutorService.submit(new Callable() { + + @Override + public Boolean call() { + try { + // 组内适配器穿行运行,尽量不要配置组内适配器 + for (CanalOuterAdapter c : adapters) { + long begin = System.currentTimeMillis(); + Dml dml = MessageUtil.flatMessage2Dml(flatMessage); + c.writeOut(dml); + if (logger.isDebugEnabled()) { + logger.debug("{} elapsed time: {}", + c.getClass().getName(), + (System.currentTimeMillis() - begin)); + } + } + return true; + } catch (Exception e) { + return false; + } + } + })); + + // 等待所有适配器写入完成 + // 由于是组间并发操作,所以将阻塞直到耗时最久的工作组操作完成 + for (Future f : futures) { + try { + if (!f.get()) { + logger.error("Outer adapter write failed"); + } + } catch (InterruptedException | ExecutionException e) { + // ignore } } } diff --git a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterKafkaWorker.java b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterKafkaWorker.java index ab26c891..3775ed11 100644 --- a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterKafkaWorker.java +++ b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterKafkaWorker.java @@ -12,6 +12,7 @@ import org.apache.kafka.common.errors.WakeupException; import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; import com.alibaba.otter.canal.client.kafka.KafkaCanalConnector; import com.alibaba.otter.canal.client.kafka.KafkaCanalConnectors; +import com.alibaba.otter.canal.protocol.FlatMessage; import com.alibaba.otter.canal.protocol.Message; /** @@ -24,16 +25,19 @@ public class CanalAdapterKafkaWorker extends AbstractCanalAdapterWorker { private KafkaCanalConnector connector; - private String topic; + private String topic; - public CanalAdapterKafkaWorker(String zkServers, String bootstrapServers, String topic, String groupId, - List> canalOuterAdapters) { + private boolean flatMessage; + + public CanalAdapterKafkaWorker(String bootstrapServers, String topic, String groupId, + List> canalOuterAdapters, boolean flatMessage){ this.canalOuterAdapters = canalOuterAdapters; this.groupInnerExecutorService = Executors.newFixedThreadPool(canalOuterAdapters.size()); this.topic = topic; this.canalDestination = topic; - connector = KafkaCanalConnectors.newKafkaConnector(zkServers, bootstrapServers, topic, null, groupId); - // connector.setSessionTimeout(5L, TimeUnit.MINUTES); + this.flatMessage = flatMessage; + connector = KafkaCanalConnectors.newKafkaConnector(bootstrapServers, topic, null, groupId, flatMessage); + // connector.setSessionTimeout(1L, TimeUnit.MINUTES); // super.initSwitcher(topic); } @@ -60,11 +64,29 @@ public class CanalAdapterKafkaWorker extends AbstractCanalAdapterWorker { if (!running) { return; } + connector.stopRunning(); running = false; - logger.info("Stop topic {} out adapters begin", this.topic); - stopOutAdapters(); - logger.info("Stop topic {} out adapters end", this.topic); + + // if (switcher != null && !switcher.state()) { + // switcher.set(true); + // } + + if (thread != null) { + try { + thread.join(); + } catch (InterruptedException e) { + // ignore + } + } + groupInnerExecutorService.shutdown(); + logger.info("topic {} connectors' worker thread dead!", this.topic); + for (List outerAdapters : canalOuterAdapters) { + for (CanalOuterAdapter adapter : outerAdapters) { + adapter.destroy(); + } + } + logger.info("topic {} all connectors destroyed!", this.topic); } catch (Exception e) { logger.error(e.getMessage(), e); } @@ -79,39 +101,54 @@ public class CanalAdapterKafkaWorker extends AbstractCanalAdapterWorker { try { logger.info("=============> Start to connect topic: {} <=============", this.topic); connector.connect(); - logger.info("=============> Start to subscribe topic: {}<=============", this.topic); + logger.info("=============> Start to subscribe topic: {} <=============", this.topic); connector.subscribe(); - logger.info("=============> Subscribe topic: {} succeed<=============", this.topic); + logger.info("=============> Subscribe topic: {} succeed <=============", this.topic); while (running) { try { // switcher.get(); //等待开关开启 - final Message message = connector.getWithoutAck(); + List messages; + if (!flatMessage) { + messages = connector.getWithoutAck(); + } else { + messages = connector.getFlatMessageWithoutAck(100L, TimeUnit.MILLISECONDS); + } + if (messages != null) { + for (final Object message : messages) { + executing.set(true); + if (message != null) { + executor.submit(new Runnable() { - executing.set(true); - if (message != null) { - executor.submit(new Runnable() { + @Override + public void run() { + try { + if (message instanceof FlatMessage) { + writeOut((FlatMessage) message); + } else { + writeOut((Message) message); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + } finally { + executing.compareAndSet(true, false); + } + } + }); - @Override - public void run() { - try { - writeOut(message, topic); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } finally { - executing.compareAndSet(true, false); + // 间隔一段时间ack一次, 防止因超时未响应切换到另外台客户端 + long currentTS = System.currentTimeMillis(); + while (executing.get()) { + // 大于10秒未消费完ack一次keep alive + if (System.currentTimeMillis() - currentTS > 10000) { + connector.ack(); + currentTS = System.currentTimeMillis(); + } } } - }); - - // 间隔一段时间ack一次, 防止因超时未响应切换到另外台客户端 - while (executing.get()) { - connector.ack(); - Thread.sleep(500); } - } else { - connector.ack(); } + connector.ack(); } catch (CommitFailedException e) { logger.warn(e.getMessage()); } catch (Exception e) { @@ -131,7 +168,7 @@ public class CanalAdapterKafkaWorker extends AbstractCanalAdapterWorker { } catch (WakeupException e) { // No-op. Continue process } - connector.disconnnect(); + connector.disconnect(); logger.info("=============> Disconnect topic: {} <=============", this.topic); } -} +} \ No newline at end of file diff --git a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterLoader.java b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterLoader.java index 0234a924..59f1b3cf 100644 --- a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterLoader.java +++ b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterLoader.java @@ -4,10 +4,6 @@ import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; import com.alibaba.otter.canal.client.adapter.support.CanalClientConfig; import com.alibaba.otter.canal.client.adapter.support.CanalOuterAdapterConfiguration; import com.alibaba.otter.canal.client.adapter.support.ExtensionLoader; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.ArrayList; @@ -16,6 +12,9 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * MQ外部适配器的加载器 @@ -94,7 +93,6 @@ public class CanalAdapterLoader { loadConnector(config, canalOuterAdapters); } canalOuterAdapterGroups.add(canalOuterAdapters); - if (StringUtils.isBlank(topic.getMqMode()) || "rocketmq".equalsIgnoreCase(topic.getMqMode())) { CanalAdapterRocketMQWorker rocketMQWorker = new CanalAdapterRocketMQWorker( canalClientConfig.getBootstrapServers(), @@ -104,16 +102,17 @@ public class CanalAdapterLoader { canalMQWorker.put(topic.getTopic() + "-rocketmq-" + group.getGroupId(), rocketMQWorker); rocketMQWorker.start(); } else if ("kafka".equalsIgnoreCase(topic.getMqMode())) { - CanalAdapterKafkaWorker canalKafkaWorker = new CanalAdapterKafkaWorker(zkHosts, + CanalAdapterKafkaWorker canalKafkaWorker = new CanalAdapterKafkaWorker( canalClientConfig.getBootstrapServers(), topic.getTopic(), group.getGroupId(), - canalOuterAdapterGroups); + canalOuterAdapterGroups,canalClientConfig.getFlatMessage()); canalMQWorker.put(topic.getTopic() + "-kafka-" + group.getGroupId(), canalKafkaWorker); canalKafkaWorker.start(); } logger.info("Start adapter for canal-client rocketmq topic: {} succeed", topic.getTopic() + "-" + group.getGroupId()); + } } } diff --git a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterWorker.java b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterWorker.java index bca40041..e341c6a3 100644 --- a/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterWorker.java +++ b/client-launcher/src/main/java/com/alibaba/otter/canal/client/adapter/loader/CanalAdapterWorker.java @@ -1,16 +1,15 @@ package com.alibaba.otter.canal.client.adapter.loader; -import com.alibaba.otter.canal.client.CanalConnector; -import com.alibaba.otter.canal.client.CanalConnectors; -import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; -import com.alibaba.otter.canal.client.adapter.loader.AbstractCanalAdapterWorker; -import com.alibaba.otter.canal.client.impl.ClusterCanalConnector; -import com.alibaba.otter.canal.protocol.Message; - import java.net.SocketAddress; import java.util.List; import java.util.concurrent.Executors; +import com.alibaba.otter.canal.client.CanalConnector; +import com.alibaba.otter.canal.client.CanalConnectors; +import com.alibaba.otter.canal.client.adapter.CanalOuterAdapter; +import com.alibaba.otter.canal.client.impl.ClusterCanalConnector; +import com.alibaba.otter.canal.protocol.Message; + /** * 原生canal-server对应的client适配器工作线程 * diff --git a/client-launcher/src/main/resources/canal-client.yml b/client-launcher/src/main/resources/canal-client.yml index 2556de6c..6aac0978 100644 --- a/client-launcher/src/main/resources/canal-client.yml +++ b/client-launcher/src/main/resources/canal-client.yml @@ -1,6 +1,7 @@ -canalServerHost: 127.0.0.1:11111 +#canalServerHost: 127.0.0.1:11111 #zookeeperHosts: slave1:2181 -#bootstrapServers: slave1:6667,slave2:6667 #or rocketmq nameservers +bootstrapServers: slave1:6667,slave2:6667 #or rocketmq nameservers +flatMessage: true #canalInstances: #- instance: example diff --git a/client/pom.xml b/client/pom.xml index b44e3129..43b3067f 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -1,115 +1,265 @@ - - 4.0.0 - - com.alibaba.otter - canal - 1.1.1-SNAPSHOT - ../pom.xml - - com.alibaba.otter - canal.client - jar - canal client module for otter ${project.version} - - - com.alibaba.otter - canal.protocol - ${project.version} - - - - org.apache.kafka - kafka-clients - 1.1.1 - provided - - - org.apache.rocketmq - rocketmq-client - 4.3.0 - - - - junit - junit - - + + 4.0.0 + + com.alibaba.otter + canal + 1.1.1-SNAPSHOT + ../pom.xml + + com.alibaba.otter + canal.client + jar + canal client module for otter ${project.version} + + + com.alibaba.otter + canal.protocol + ${project.version} + true + - - - dev - - true - - env - !javadoc - - - + + com.google.protobuf + protobuf-java + - - javadoc - - - env - javadoc - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - package - - jar - - - - - true - public - true -
    ${project.artifactId}-${project.version}
    -
    ${project.artifactId}-${project.version}
    - ${project.artifactId}-${project.version} - - https://github.com/alibaba/canal - - ${project.build.directory}/apidocs/apidocs/${project.version} - -
    -
    - - org.apache.maven.plugins - maven-scm-publish-plugin - 1.0-beta-2 - - - attach-javadocs - package - - publish-scm - - - - - ${project.build.directory}/scmpublish - Publishing javadoc for ${project.artifactId}:${project.version} - - ${project.build.directory}/apidocs - true - scm:git:git@github.com:alibaba/canal.git - gh-pages - - -
    -
    -
    -
    + + + io.netty + netty-all + + + + org.apache.zookeeper + zookeeper + + + com.101tec + zkclient + + + + commons-io + commons-io + + + commons-lang + commons-lang + + + commons-codec + commons-codec + + + com.alibaba + fastjson + + + com.google.guava + guava + + + + ch.qos.logback + logback-core + + + ch.qos.logback + logback-classic + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + slf4j-api + + + org.springframework + spring-core + + + org.springframework + spring-aop + + + org.springframework + spring-context + + + org.springframework + spring-jdbc + + + org.springframework + spring-orm + + + org.springframework + spring-test + ${spring_version} + test + + + org.apache.rocketmq + rocketmq-client + 4.3.0 + + + + org.apache.kafka + kafka-clients + 1.1.1 + provided + + + + + junit + junit + test + +
    + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.1 + + false + + + org.apache.zookeeper:zookeeper + com.101tec:zkclient + commons-io:commons-io + commons-lang:commons-lang + commons-codec:commons-codec + com.alibaba:fastjson + ch.qos.logback:logback-core + ch.qos.logback:logback-classic + org.slf4j:jcl-over-slf4j + org.slf4j:slf4j-api + org.springframework:* + org.jboss.netty:netty + commons-logging:commons-logging + aopalliance:aopalliance + com.google.protobuf:protobuf-java + io.netty:* + junit:junit + + + + + + package + + shade + + + + + com.google.guava + com.alibaba.google.guava + + + org.joda + com.alibaba.google.joda + + + com.google.common + com.alibaba.google.common + + + com.google.thirdparty + com.alibaba.google.thirdparty + + + + + + + + + + + + + + + dev + + true + + env + !javadoc + + + + + + javadoc + + + env + javadoc + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + package + + jar + + + + + true + public + true +
    ${project.artifactId}-${project.version}
    +
    ${project.artifactId}-${project.version}
    + ${project.artifactId}-${project.version} + + https://github.com/alibaba/canal + + ${project.build.directory}/apidocs/apidocs/${project.version} +
    +
    + + org.apache.maven.plugins + maven-scm-publish-plugin + 1.0-beta-2 + + + attach-javadocs + package + + publish-scm + + + + + ${project.build.directory}/scmpublish + Publishing javadoc for ${project.artifactId}:${project.version} + ${project.build.directory}/apidocs + true + scm:git:git@github.com:alibaba/canal.git + gh-pages + + +
    +
    +
    +
    diff --git a/client/src/main/java/com/alibaba/otter/canal/client/DeserializerUtil.java b/client/src/main/java/com/alibaba/otter/canal/client/CanalMessageDeserializer.java similarity index 78% rename from client/src/main/java/com/alibaba/otter/canal/client/DeserializerUtil.java rename to client/src/main/java/com/alibaba/otter/canal/client/CanalMessageDeserializer.java index 54b1bb7a..2e7cd5e5 100644 --- a/client/src/main/java/com/alibaba/otter/canal/client/DeserializerUtil.java +++ b/client/src/main/java/com/alibaba/otter/canal/client/CanalMessageDeserializer.java @@ -8,8 +8,8 @@ import com.google.protobuf.ByteString; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DeserializerUtil { - private static Logger logger = LoggerFactory.getLogger(DeserializerUtil.class); +public class CanalMessageDeserializer { + private static Logger logger = LoggerFactory.getLogger(CanalMessageDeserializer.class); public static Message deserializer(byte[] data) { try { @@ -19,9 +19,9 @@ public class DeserializerUtil { CanalPacket.Packet p = CanalPacket.Packet.parseFrom(data); switch (p.getType()) { case MESSAGES: { - if (!p.getCompression().equals(CanalPacket.Compression.NONE)) { - throw new CanalClientException("compression is not supported in this connector"); - } +// if (!p.getCompression().equals(CanalPacket.Compression.NONE)) { +// throw new CanalClientException("compression is not supported in this connector"); +// } CanalPacket.Messages messages = CanalPacket.Messages.parseFrom(p.getBody()); Message result = new Message(messages.getBatchId()); diff --git a/client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java b/client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java index 0f29794d..599c678c 100644 --- a/client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java +++ b/client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleCanalConnector.java @@ -159,7 +159,7 @@ public class SimpleCanalConnector implements CanalConnector { } // Handshake handshake = Handshake.parseFrom(p.getBody()); - supportedCompressions.addAll(handshake.getSupportedCompressionsList()); + supportedCompressions.add(handshake.getSupportedCompressions()); // ClientAuth ca = ClientAuth.newBuilder() .setUsername(username != null ? username : "") @@ -180,8 +180,8 @@ public class SimpleCanalConnector implements CanalConnector { Ack ackBody = Ack.parseFrom(ack.getBody()); if (ackBody.getErrorCode() > 0) { - throw new CanalClientException("something goes wrong when doing authentication: " - + ackBody.getErrorMessage()); + throw new CanalClientException( + "something goes wrong when doing authentication: " + ackBody.getErrorMessage()); } connected = true; @@ -323,7 +323,8 @@ public class SimpleCanalConnector implements CanalConnector { Packet p = Packet.parseFrom(data); switch (p.getType()) { case MESSAGES: { - if (!p.getCompression().equals(Compression.NONE)) { + if (!p.getCompression().equals(Compression.NONE) + && !p.getCompression().equals(Compression.COMPRESSIONCOMPATIBLEPROTO2)) { throw new CanalClientException("compression is not supported in this connector"); } @@ -360,11 +361,8 @@ public class SimpleCanalConnector implements CanalConnector { .setBatchId(batchId) .build(); try { - writeWithHeader(Packet.newBuilder() - .setType(PacketType.CLIENTACK) - .setBody(ca.toByteString()) - .build() - .toByteArray()); + writeWithHeader( + Packet.newBuilder().setType(PacketType.CLIENTACK).setBody(ca.toByteString()).build().toByteArray()); } catch (IOException e) { throw new CanalClientException(e); } diff --git a/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java b/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java index c5b2f8fc..ad94ba98 100644 --- a/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java +++ b/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java @@ -1,19 +1,20 @@ package com.alibaba.otter.canal.client.kafka; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.Properties; import java.util.concurrent.TimeUnit; +import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.serialization.StringDeserializer; -import com.alibaba.otter.canal.client.kafka.running.ClientRunningData; -import com.alibaba.otter.canal.common.utils.AddressUtils; -import com.alibaba.otter.canal.common.zookeeper.ZkClientx; +import com.alibaba.fastjson.JSON; +import com.alibaba.otter.canal.protocol.FlatMessage; import com.alibaba.otter.canal.protocol.Message; -import com.alibaba.otter.canal.protocol.exception.CanalClientException; /** * canal kafka 数据操作客户端 @@ -24,18 +25,19 @@ import com.alibaba.otter.canal.protocol.exception.CanalClientException; public class KafkaCanalConnector { private KafkaConsumer kafkaConsumer; + private KafkaConsumer kafkaConsumer2; // 用于扁平message的数据消费 private String topic; private Integer partition; private Properties properties; - // private ClientRunningMonitor runningMonitor; // 运行控制 - // private BooleanMutex mutex = new BooleanMutex(false); - private ZkClientx zkClientx; private volatile boolean connected = false; private volatile boolean running = false; + private boolean flatMessage; - public KafkaCanalConnector(String zkServers, String servers, String topic, Integer partition, String groupId){ + public KafkaCanalConnector(String servers, String topic, Integer partition, String groupId, + boolean flatMessage){ this.topic = topic; this.partition = partition; + this.flatMessage = flatMessage; properties = new Properties(); properties.put("bootstrap.servers", servers); @@ -45,32 +47,13 @@ public class KafkaCanalConnector { properties.put("auto.offset.reset", "latest"); // 如果没有offset则从最后的offset开始读 properties.put("request.timeout.ms", "40000"); // 必须大于session.timeout.ms的设置 properties.put("session.timeout.ms", "30000"); // 默认为30秒 - properties.put("max.poll.records", "1"); // 所以一次只取一条数据 + properties.put("max.poll.records", "100"); properties.put("key.deserializer", StringDeserializer.class.getName()); - properties.put("value.deserializer", MessageDeserializer.class.getName()); - - if (zkServers != null) { - zkClientx = new ZkClientx(zkServers); - - ClientRunningData clientData = new ClientRunningData(); - clientData.setGroupId(groupId); - clientData.setAddress(AddressUtils.getHostIp()); - - // runningMonitor = new ClientRunningMonitor(); - // runningMonitor.setTopic(topic); - // runningMonitor.setZkClient(zkClientx); - // runningMonitor.setClientData(clientData); - // runningMonitor.setListener(new ClientRunningListener() { - // public void processActiveEnter() { - // mutex.set(true); - // } - // - // public void processActiveExit() { - // mutex.set(false); - // } - // }); + if (!flatMessage) { + properties.put("value.deserializer", MessageDeserializer.class.getName()); + } else { + properties.put("value.deserializer", StringDeserializer.class.getName()); } - } /** @@ -93,57 +76,36 @@ public class KafkaCanalConnector { return; } - // if (runningMonitor != null) { - // if (!runningMonitor.isStart()) { - // runningMonitor.start(); - // } - // } - connected = true; - if (kafkaConsumer == null) { + if (kafkaConsumer == null && !flatMessage) { kafkaConsumer = new KafkaConsumer(properties); } + if (kafkaConsumer2 == null && flatMessage) { + kafkaConsumer2 = new KafkaConsumer(properties); + } } /** * 关闭链接 */ - public void disconnnect() { - kafkaConsumer.close(); + public void disconnect() { + if (kafkaConsumer != null) { + kafkaConsumer.close(); + } + if (kafkaConsumer2 != null) { + kafkaConsumer2.close(); + } connected = false; - // if (runningMonitor.isStart()) { - // runningMonitor.stop(); - // } } private void waitClientRunning() { - try { - if (zkClientx != null) { - if (!connected) {// 未调用connect - throw new CanalClientException("should connect first"); - } - - running = true; - // mutex.get();// 阻塞等待 - } else { - // 单机模式直接设置为running - running = true; - } - } catch (Exception e) { - Thread.currentThread().interrupt(); - throw new CanalClientException(e); - } + running = true; } public boolean checkValid() { - if (zkClientx != null) { - // return mutex.state(); - return true; - } else { - return true;// 默认都放过 - } + return true;// 默认都放过 } /** @@ -156,10 +118,20 @@ public class KafkaCanalConnector { } if (partition == null) { - kafkaConsumer.subscribe(Collections.singletonList(topic)); + if (kafkaConsumer != null) { + kafkaConsumer.subscribe(Collections.singletonList(topic)); + } + if (kafkaConsumer2 != null) { + kafkaConsumer2.subscribe(Collections.singletonList(topic)); + } } else { TopicPartition topicPartition = new TopicPartition(topic, partition); - kafkaConsumer.assign(Collections.singletonList(topicPartition)); + if (kafkaConsumer != null) { + kafkaConsumer.assign(Collections.singletonList(topicPartition)); + } + if (kafkaConsumer2 != null) { + kafkaConsumer2.assign(Collections.singletonList(topicPartition)); + } } } @@ -172,7 +144,12 @@ public class KafkaCanalConnector { return; } - kafkaConsumer.unsubscribe(); + if (kafkaConsumer != null) { + kafkaConsumer.unsubscribe(); + } + if (kafkaConsumer2 != null) { + kafkaConsumer2.unsubscribe(); + } } /** @@ -180,22 +157,22 @@ public class KafkaCanalConnector { * * @return */ - public Message get() { + public List get() { return get(100L, TimeUnit.MILLISECONDS); } - public Message get(Long timeout, TimeUnit unit) { + public List get(Long timeout, TimeUnit unit) { waitClientRunning(); if (!running) { return null; } - Message message = getWithoutAck(timeout, unit); + List messages = getWithoutAck(timeout, unit); this.ack(); - return message; + return messages; } - public Message getWithoutAck() { + public List getWithoutAck() { return getWithoutAck(100L, TimeUnit.MILLISECONDS); } @@ -204,7 +181,7 @@ public class KafkaCanalConnector { * * @return */ - public Message getWithoutAck(Long timeout, TimeUnit unit) { + public List getWithoutAck(Long timeout, TimeUnit unit) { waitClientRunning(); if (!running) { return null; @@ -213,7 +190,33 @@ public class KafkaCanalConnector { ConsumerRecords records = kafkaConsumer.poll(unit.toMillis(timeout)); // 基于配置,最多只能poll到一条数据 if (!records.isEmpty()) { - return records.iterator().next().value(); + // return records.iterator().next().value(); + List messages = new ArrayList<>(); + for (ConsumerRecord record : records) { + messages.add(record.value()); + } + return messages; + } + return null; + } + + public List getFlatMessageWithoutAck(Long timeout, TimeUnit unit) { + waitClientRunning(); + if (!running) { + return null; + } + + ConsumerRecords records = kafkaConsumer2.poll(unit.toMillis(timeout)); + + if (!records.isEmpty()) { + List flatMessages = new ArrayList<>(); + for (ConsumerRecord record : records) { + String flatMessageJson = record.value(); + FlatMessage flatMessage = JSON.parseObject(flatMessageJson, FlatMessage.class); + flatMessages.add(flatMessage); + } + + return flatMessages; } return null; } @@ -227,7 +230,12 @@ public class KafkaCanalConnector { return; } - kafkaConsumer.commitSync(); + if (kafkaConsumer != null) { + kafkaConsumer.commitSync(); + } + if (kafkaConsumer2 != null) { + kafkaConsumer2.commitAsync(); + } } public void stopRunning() { diff --git a/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnectors.java b/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnectors.java index 0634a747..436fde8f 100644 --- a/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnectors.java +++ b/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnectors.java @@ -17,8 +17,9 @@ public class KafkaCanalConnectors { * @param groupId * @return */ - public static KafkaCanalConnector newKafkaConnector(String servers, String topic, Integer partition, String groupId) { - return new KafkaCanalConnector(null, servers, topic, partition, groupId); + public static KafkaCanalConnector newKafkaConnector(String servers, String topic, Integer partition, + String groupId) { + return new KafkaCanalConnector(servers, topic, partition, groupId, false); } /** @@ -30,33 +31,21 @@ public class KafkaCanalConnectors { * @return */ public static KafkaCanalConnector newKafkaConnector(String servers, String topic, String groupId) { - return new KafkaCanalConnector(null, servers, topic, null, groupId); + return new KafkaCanalConnector(servers, topic, null, groupId, false); } /** * 创建kafka客户端链接 * - * @param zkServers * @param servers * @param topic * @param partition * @param groupId + * @param flatMessage * @return */ - public static KafkaCanalConnector newKafkaConnector(String zkServers, String servers, String topic, Integer partition, String groupId) { - return new KafkaCanalConnector(zkServers, servers, topic, partition, groupId); - } - - /** - * 创建kafka客户端链接 - * - * @param zkServers - * @param servers - * @param topic - * @param groupId - * @return - */ - public static KafkaCanalConnector newKafkaConnector(String zkServers, String servers, String topic, String groupId) { - return new KafkaCanalConnector(zkServers, servers, topic, null, groupId); + public static KafkaCanalConnector newKafkaConnector( String servers, String topic, + Integer partition, String groupId,boolean flatMessage) { + return new KafkaCanalConnector(servers, topic, partition, groupId, flatMessage); } } diff --git a/client/src/main/java/com/alibaba/otter/canal/client/kafka/MessageDeserializer.java b/client/src/main/java/com/alibaba/otter/canal/client/kafka/MessageDeserializer.java index af381283..6de67c7a 100644 --- a/client/src/main/java/com/alibaba/otter/canal/client/kafka/MessageDeserializer.java +++ b/client/src/main/java/com/alibaba/otter/canal/client/kafka/MessageDeserializer.java @@ -1,6 +1,6 @@ package com.alibaba.otter.canal.client.kafka; -import com.alibaba.otter.canal.client.DeserializerUtil; +import com.alibaba.otter.canal.client.CanalMessageDeserializer; import com.alibaba.otter.canal.protocol.Message; import java.util.Map; import org.apache.kafka.common.serialization.Deserializer; @@ -23,7 +23,7 @@ public class MessageDeserializer implements Deserializer { @Override public Message deserialize(String topic1, byte[] data) { - return DeserializerUtil.deserializer(data); + return CanalMessageDeserializer.deserializer(data); } @Override diff --git a/client/src/main/java/com/alibaba/otter/canal/client/rocketmq/RocketMQCanalConnector.java b/client/src/main/java/com/alibaba/otter/canal/client/rocketmq/RocketMQCanalConnector.java index a1d249c6..0465ec6c 100644 --- a/client/src/main/java/com/alibaba/otter/canal/client/rocketmq/RocketMQCanalConnector.java +++ b/client/src/main/java/com/alibaba/otter/canal/client/rocketmq/RocketMQCanalConnector.java @@ -1,7 +1,7 @@ package com.alibaba.otter.canal.client.rocketmq; import com.alibaba.otter.canal.client.CanalConnector; -import com.alibaba.otter.canal.client.DeserializerUtil; +import com.alibaba.otter.canal.client.CanalMessageDeserializer; import com.alibaba.otter.canal.protocol.Message; import com.alibaba.otter.canal.protocol.exception.CanalClientException; import java.util.List; @@ -94,7 +94,7 @@ public class RocketMQCanalConnector implements CanalConnector { BlockingQueue messageList = new LinkedBlockingQueue<>(); for (MessageExt messageExt : messageExts) { byte[] data = messageExt.getBody(); - Message message = DeserializerUtil.deserializer(data); + Message message = CanalMessageDeserializer.deserializer(data); try { messageList.put(message); } catch (InterruptedException ex) { diff --git a/client/src/test/java/com/alibaba/otter/canal/client/running/ClientRunningTest.java b/client/src/test/java/com/alibaba/otter/canal/client/running/ClientRunningTest.java index cbdfd0ea..40755671 100644 --- a/client/src/test/java/com/alibaba/otter/canal/client/running/ClientRunningTest.java +++ b/client/src/test/java/com/alibaba/otter/canal/client/running/ClientRunningTest.java @@ -20,117 +20,117 @@ import com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils; public class ClientRunningTest extends AbstractZkTest { - private ZkClientx zkclientx = new ZkClientx(cluster1 + ";" + cluster2); - private short clientId = 1001; + private ZkClientx zkclientx = new ZkClientx(cluster1 + ";" + cluster2); + private short clientId = 1001; - @Before - public void setUp() { - String path = ZookeeperPathUtils.getDestinationPath(destination); - zkclientx.deleteRecursive(path); + @Before + public void setUp() { + String path = ZookeeperPathUtils.getDestinationPath(destination); + zkclientx.deleteRecursive(path); - zkclientx.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientId), true); - } + zkclientx.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientId), true); + } - @After - public void tearDown() { - String path = ZookeeperPathUtils.getDestinationPath(destination); - zkclientx.deleteRecursive(path); - } + @After + public void tearDown() { + String path = ZookeeperPathUtils.getDestinationPath(destination); + zkclientx.deleteRecursive(path); + } - @Test - public void testOneServer() { - final CountDownLatch countLatch = new CountDownLatch(2); - ClientRunningMonitor runningMonitor = buildClientRunning(countLatch, clientId, 2088); - runningMonitor.start(); - sleep(2000L); - runningMonitor.stop(); - sleep(2000L); + @Test + public void testOneServer() { + final CountDownLatch countLatch = new CountDownLatch(2); + ClientRunningMonitor runningMonitor = buildClientRunning(countLatch, clientId, 2088); + runningMonitor.start(); + sleep(2000L); + runningMonitor.stop(); + sleep(2000L); - if (countLatch.getCount() != 0) { - Assert.fail(); - } - } + if (countLatch.getCount() != 0) { + Assert.fail(); + } + } - @Test - public void testMultiServer() { - final CountDownLatch countLatch = new CountDownLatch(30); - final ClientRunningMonitor runningMonitor1 = buildClientRunning(countLatch, clientId, 2088); - final ClientRunningMonitor runningMonitor2 = buildClientRunning(countLatch, clientId, 2089); - final ClientRunningMonitor runningMonitor3 = buildClientRunning(countLatch, clientId, 2090); - final ExecutorService executor = Executors.newFixedThreadPool(3); - executor.submit(new Runnable() { + @Test + public void testMultiServer() { + final CountDownLatch countLatch = new CountDownLatch(30); + final ClientRunningMonitor runningMonitor1 = buildClientRunning(countLatch, clientId, 2088); + final ClientRunningMonitor runningMonitor2 = buildClientRunning(countLatch, clientId, 2089); + final ClientRunningMonitor runningMonitor3 = buildClientRunning(countLatch, clientId, 2090); + final ExecutorService executor = Executors.newFixedThreadPool(3); + executor.submit(new Runnable() { - public void run() { - for (int i = 0; i < 10; i++) { - if (!runningMonitor1.isStart()) { - runningMonitor1.start(); - } - sleep(2000L + RandomUtils.nextInt(500)); - runningMonitor1.stop(); - sleep(2000L + RandomUtils.nextInt(500)); - } - } + public void run() { + for (int i = 0; i < 10; i++) { + if (!runningMonitor1.isStart()) { + runningMonitor1.start(); + } + sleep(2000L + RandomUtils.nextInt(500)); + runningMonitor1.stop(); + sleep(2000L + RandomUtils.nextInt(500)); + } + } - }); + }); - executor.submit(new Runnable() { + executor.submit(new Runnable() { - public void run() { - for (int i = 0; i < 10; i++) { - if (!runningMonitor2.isStart()) { - runningMonitor2.start(); - } - sleep(2000L + RandomUtils.nextInt(500)); - runningMonitor2.stop(); - sleep(2000L + RandomUtils.nextInt(500)); - } - } + public void run() { + for (int i = 0; i < 10; i++) { + if (!runningMonitor2.isStart()) { + runningMonitor2.start(); + } + sleep(2000L + RandomUtils.nextInt(500)); + runningMonitor2.stop(); + sleep(2000L + RandomUtils.nextInt(500)); + } + } - }); + }); - executor.submit(new Runnable() { + executor.submit(new Runnable() { - public void run() { - for (int i = 0; i < 10; i++) { - if (!runningMonitor3.isStart()) { - runningMonitor3.start(); - } - sleep(2000L + RandomUtils.nextInt(500)); - runningMonitor3.stop(); - sleep(2000L + RandomUtils.nextInt(500)); - } - } + public void run() { + for (int i = 0; i < 10; i++) { + if (!runningMonitor3.isStart()) { + runningMonitor3.start(); + } + sleep(2000L + RandomUtils.nextInt(500)); + runningMonitor3.stop(); + sleep(2000L + RandomUtils.nextInt(500)); + } + } - }); + }); - sleep(30000L); - } + sleep(30000L); + } - private ClientRunningMonitor buildClientRunning(final CountDownLatch countLatch, final short clientId, - final int port) { - ClientRunningData clientData = new ClientRunningData(); - clientData.setClientId(clientId); - clientData.setAddress(AddressUtils.getHostIp()); + private ClientRunningMonitor buildClientRunning(final CountDownLatch countLatch, final short clientId, + final int port) { + ClientRunningData clientData = new ClientRunningData(); + clientData.setClientId(clientId); + clientData.setAddress(AddressUtils.getHostIp()); - ClientRunningMonitor runningMonitor = new ClientRunningMonitor(); - runningMonitor.setDestination(destination); - runningMonitor.setZkClient(zkclientx); - runningMonitor.setClientData(clientData); - runningMonitor.setListener(new ClientRunningListener() { + ClientRunningMonitor runningMonitor = new ClientRunningMonitor(); + runningMonitor.setDestination(destination); + runningMonitor.setZkClient(zkclientx); + runningMonitor.setClientData(clientData); + runningMonitor.setListener(new ClientRunningListener() { - public InetSocketAddress processActiveEnter() { - System.out.println(String.format("clientId:%s port:%s has start", clientId, port)); - countLatch.countDown(); - return new InetSocketAddress(AddressUtils.getHostIp(), port); - } + public InetSocketAddress processActiveEnter() { + System.out.println(String.format("clientId:%s port:%s has start", clientId, port)); + countLatch.countDown(); + return new InetSocketAddress(AddressUtils.getHostIp(), port); + } - public void processActiveExit() { - countLatch.countDown(); - System.out.println(String.format("clientId:%s port:%s has stop", clientId, port)); - } + public void processActiveExit() { + countLatch.countDown(); + System.out.println(String.format("clientId:%s port:%s has stop", clientId, port)); + } - }); - runningMonitor.setDelayTime(1); - return runningMonitor; - } -} + }); + runningMonitor.setDelayTime(1); + return runningMonitor; + } +} \ No newline at end of file diff --git a/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/CanalKafkaClientExample.java b/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/CanalKafkaClientExample.java index 0a53a1df..93f443cd 100644 --- a/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/CanalKafkaClientExample.java +++ b/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/CanalKafkaClientExample.java @@ -1,5 +1,6 @@ package com.alibaba.otter.canal.client.running.kafka; +import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.kafka.common.errors.WakeupException; @@ -19,32 +20,33 @@ import com.alibaba.otter.canal.protocol.Message; */ public class CanalKafkaClientExample { - protected final static Logger logger = LoggerFactory.getLogger(CanalKafkaClientExample.class); + protected final static Logger logger = LoggerFactory.getLogger(CanalKafkaClientExample.class); - private KafkaCanalConnector connector; + private KafkaCanalConnector connector; - private static volatile boolean running = false; + private static volatile boolean running = false; - private Thread thread = null; + private Thread thread = null; private Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { - public void uncaughtException(Thread t, Throwable e) { - logger.error("parse events has an error", e); - } - }; + public void uncaughtException(Thread t, Throwable e) { + logger.error("parse events has an error", e); + } + }; - public CanalKafkaClientExample(String zkServers, String servers, String topic, Integer partition, String groupId) { - connector = KafkaCanalConnectors.newKafkaConnector(zkServers, servers, topic, partition, groupId); + public CanalKafkaClientExample(String zkServers, String servers, String topic, Integer partition, String groupId){ + connector = KafkaCanalConnectors.newKafkaConnector(servers, topic, partition, groupId, false); } public static void main(String[] args) { try { - final CanalKafkaClientExample kafkaCanalClientExample = new CanalKafkaClientExample(AbstractKafkaTest.zkServers, - AbstractKafkaTest.servers, - AbstractKafkaTest.topic, - AbstractKafkaTest.partition, - AbstractKafkaTest.groupId); + final CanalKafkaClientExample kafkaCanalClientExample = new CanalKafkaClientExample( + AbstractKafkaTest.zkServers, + AbstractKafkaTest.servers, + AbstractKafkaTest.topic, + AbstractKafkaTest.partition, + AbstractKafkaTest.groupId); logger.info("## start the kafka consumer: {}-{}", AbstractKafkaTest.topic, AbstractKafkaTest.groupId); kafkaCanalClientExample.start(); logger.info("## the canal kafka consumer is running now ......"); @@ -107,21 +109,24 @@ public class CanalKafkaClientExample { connector.subscribe(); while (running) { try { - Message message = connector.getWithoutAck(1L, TimeUnit.SECONDS); // 获取message - if (message == null) { + List messages = connector.getWithoutAck(1L, TimeUnit.SECONDS); // 获取message + + if (messages == null) { continue; } - long batchId = message.getId(); - int size = message.getEntries().size(); - if (batchId == -1 || size == 0) { - // try { - // Thread.sleep(1000); - // } catch (InterruptedException e) { - // } - } else { - // printSummary(message, batchId, size); - // printEntry(message.getEntries()); - logger.info(message.toString()); + for (Message message : messages) { + long batchId = message.getId(); + int size = message.getEntries().size(); + if (batchId == -1 || size == 0) { + // try { + // Thread.sleep(1000); + // } catch (InterruptedException e) { + // } + } else { + // printSummary(message, batchId, size); + // printEntry(message.getEntries()); + logger.info(message.toString()); + } } connector.ack(); // 提交确认 @@ -139,6 +144,6 @@ public class CanalKafkaClientExample { } catch (WakeupException e) { // No-op. Continue process } - connector.disconnnect(); + connector.disconnect(); } } diff --git a/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/KafkaClientRunningTest.java b/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/KafkaClientRunningTest.java index ebc4d549..fcdc0bf6 100644 --- a/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/KafkaClientRunningTest.java +++ b/client/src/test/java/com/alibaba/otter/canal/client/running/kafka/KafkaClientRunningTest.java @@ -1,5 +1,6 @@ package com.alibaba.otter.canal.client.running.kafka; +import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -39,9 +40,9 @@ public class KafkaClientRunningTest extends AbstractKafkaTest { connector.subscribe(); while (running) { try { - Message message = connector.getWithoutAck(3L, TimeUnit.SECONDS); - if (message != null) { - System.out.println(message); + List messages = connector.getWithoutAck(3L, TimeUnit.SECONDS); + if (messages != null) { + System.out.println(messages); } connector.ack(); } catch (WakeupException e) { @@ -49,7 +50,7 @@ public class KafkaClientRunningTest extends AbstractKafkaTest { } } connector.unsubscribe(); - connector.disconnnect(); + connector.disconnect(); } }); diff --git a/dbsync/pom.xml b/dbsync/pom.xml index f4d20a10..ac606af4 100644 --- a/dbsync/pom.xml +++ b/dbsync/pom.xml @@ -11,6 +11,11 @@ jar canal dbsync module for otter ${project.version} + + com.alibaba.otter + canal.parse.driver + ${project.version} + ch.qos.logback diff --git a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogContext.java b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogContext.java index 8d88d00d..0668ac4e 100644 --- a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogContext.java +++ b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogContext.java @@ -3,7 +3,9 @@ package com.taobao.tddl.dbsync.binlog; import java.util.HashMap; import java.util.Map; +import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.taobao.tddl.dbsync.binlog.event.FormatDescriptionLogEvent; +import com.taobao.tddl.dbsync.binlog.event.GtidLogEvent; import com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent; /** @@ -20,6 +22,10 @@ public final class LogContext { private LogPosition logPosition; + private GTIDSet gtidSet; + + private GtidLogEvent gtidLogEvent; // save current gtid log event + public LogContext(){ this.formatDescription = FormatDescriptionLogEvent.FORMAT_DESCRIPTION_EVENT_5_x; } @@ -60,4 +66,20 @@ public final class LogContext { formatDescription = FormatDescriptionLogEvent.FORMAT_DESCRIPTION_EVENT_5_x; mapOfTable.clear(); } + + public GTIDSet getGtidSet() { + return gtidSet; + } + + public void setGtidSet(GTIDSet gtidSet) { + this.gtidSet = gtidSet; + } + + public GtidLogEvent getGtidLogEvent() { + return gtidLogEvent; + } + + public void setGtidLogEvent(GtidLogEvent gtidLogEvent) { + this.gtidLogEvent = gtidLogEvent; + } } diff --git a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java index bbb358b7..6670f259 100644 --- a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java +++ b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java @@ -6,6 +6,7 @@ import java.util.BitSet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.taobao.tddl.dbsync.binlog.event.AppendBlockLogEvent; import com.taobao.tddl.dbsync.binlog.event.BeginLoadQueryLogEvent; import com.taobao.tddl.dbsync.binlog.event.CreateFileLogEvent; @@ -46,7 +47,7 @@ import com.taobao.tddl.dbsync.binlog.event.mariadb.StartEncryptionLogEvent; /** * Implements a binary-log decoder. - * + * *
      * LogDecoder decoder = new LogDecoder();
      * decoder.handle(...);
    @@ -61,7 +62,7 @@ import com.taobao.tddl.dbsync.binlog.event.mariadb.StartEncryptionLogEvent;
      * while (event != null);
      * // no more events in buffer.
      * 
    - * + * * @author Changyuan.lh * @version 1.0 */ @@ -88,7 +89,7 @@ public final class LogDecoder { /** * Decoding an event from binary-log buffer. - * + * * @return UknownLogEvent if event type is unknown or skipped, * null if buffer is not including a full event. */ @@ -140,7 +141,7 @@ public final class LogDecoder { /** * Deserialize an event from buffer. - * + * * @return UknownLogEvent if event type is unknown or skipped. */ public static LogEvent decode(LogBuffer buffer, LogHeader header, LogContext context) throws IOException { @@ -159,18 +160,21 @@ public final class LogDecoder { // remove checksum bytes buffer.limit(header.getEventLen() - LogEvent.BINLOG_CHECKSUM_LEN); } - + GTIDSet gtidSet = context.getGtidSet(); + GtidLogEvent gtidLogEvent = context.getGtidLogEvent(); switch (header.getType()) { case LogEvent.QUERY_EVENT: { QueryLogEvent event = new QueryLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.XID_EVENT: { XidLogEvent event = new XidLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.TABLE_MAP_EVENT: { @@ -268,12 +272,14 @@ public final class LogDecoder { RandLogEvent event = new RandLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.USER_VAR_EVENT: { UserVarLogEvent event = new UserVarLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.FORMAT_DESCRIPTION_EVENT: { @@ -336,6 +342,7 @@ public final class LogDecoder { RowsQueryLogEvent event = new RowsQueryLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.WRITE_ROWS_EVENT: { @@ -343,6 +350,7 @@ public final class LogDecoder { /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.UPDATE_ROWS_EVENT: { @@ -350,6 +358,7 @@ public final class LogDecoder { /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.DELETE_ROWS_EVENT: { @@ -357,6 +366,7 @@ public final class LogDecoder { /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.GTID_LOG_EVENT: @@ -364,6 +374,13 @@ public final class LogDecoder { GtidLogEvent event = new GtidLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + if (gtidSet != null) { + gtidSet.update(event.getGtidStr()); + // update latest gtid + header.putGtid(gtidSet, event); + } + // update current gtid event to context + context.setGtidLogEvent(event); return event; } case LogEvent.PREVIOUS_GTIDS_LOG_EVENT: { @@ -394,6 +411,7 @@ public final class LogDecoder { AnnotateRowsEvent event = new AnnotateRowsEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); + header.putGtid(context.getGtidSet(), gtidLogEvent); return event; } case LogEvent.BINLOG_CHECKPOINT_EVENT: { diff --git a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/GtidLogEvent.java b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/GtidLogEvent.java index 5c2678b5..49557fc6 100644 --- a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/GtidLogEvent.java +++ b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/GtidLogEvent.java @@ -14,10 +14,10 @@ import com.taobao.tddl.dbsync.binlog.LogEvent; public class GtidLogEvent extends LogEvent { // / Length of the commit_flag in event encoding - public static final int ENCODED_FLAG_LENGTH = 1; + public static final int ENCODED_FLAG_LENGTH = 1; // / Length of SID in event encoding - public static final int ENCODED_SID_LENGTH = 16; - public static final int LOGICAL_TIMESTAMP_TYPE_CODE = 2; + public static final int ENCODED_SID_LENGTH = 16; + public static final int LOGICAL_TIMESTAMP_TYPE_CODE = 2; private boolean commitFlag; private UUID sid; @@ -50,8 +50,6 @@ public class GtidLogEvent extends LogEvent { sequenceNumber = buffer.getLong64(); } - - // ignore gtid info read // sid.copy_from((uchar *)ptr_buffer); // ptr_buffer+= ENCODED_SID_LENGTH; @@ -82,4 +80,11 @@ public class GtidLogEvent extends LogEvent { public Long getSequenceNumber() { return sequenceNumber; } + + public String getGtidStr() { + StringBuilder sb = new StringBuilder(); + sb.append(sid.toString()).append(":"); + sb.append(gno); + return sb.toString(); + } } diff --git a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/LogHeader.java b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/LogHeader.java index 229693a2..ab273f1b 100644 --- a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/LogHeader.java +++ b/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/LogHeader.java @@ -1,8 +1,12 @@ package com.taobao.tddl.dbsync.binlog.event; +import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.taobao.tddl.dbsync.binlog.LogBuffer; import com.taobao.tddl.dbsync.binlog.LogEvent; +import java.util.HashMap; +import java.util.Map; + /** * The Common-Header, documented in the table @ref Table_common_header "below", * always has the same form and length within one version of MySQL. Each event @@ -120,6 +124,13 @@ public final class LogHeader { */ protected String logFileName; + protected Map gtidMap = new HashMap<>(); + + private static final String CURRENT_GTID_STRING = "curt_gtid"; + private static final String CURRENT_GTID_SN = "curt_gtid_sn"; + private static final String CURRENT_GTID_LAST_COMMIT = "curt_gtid_lct"; + private static final String GTID_SET_STRING = "gtid_str"; + /* for Start_event_v3 */ public LogHeader(final int type){ this.type = type; @@ -288,4 +299,31 @@ public final class LogHeader { crc = buffer.getUint32(eventLen - LogEvent.BINLOG_CHECKSUM_LEN); } } + + public String getGtidSetStr() { + return gtidMap.get(GTID_SET_STRING); + } + + public String getCurrentGtid() { + return gtidMap.get(CURRENT_GTID_STRING); + } + + public String getCurrentGtidSn() { + return gtidMap.get(CURRENT_GTID_SN); + } + + public String getCurrentGtidLastCommit() { + return gtidMap.get(CURRENT_GTID_LAST_COMMIT); + } + + public void putGtid(GTIDSet gtidSet, GtidLogEvent event) { + if (gtidSet != null) { + gtidMap.put(GTID_SET_STRING, gtidSet.toString()); + if (event != null) { + gtidMap.put(CURRENT_GTID_STRING, event.getGtidStr()); + gtidMap.put(CURRENT_GTID_SN, String.valueOf(event.getSequenceNumber())); + gtidMap.put(CURRENT_GTID_LAST_COMMIT, String.valueOf(event.getLastCommitted())); + } + } + } } diff --git a/dbsync/src/test/java/com/taobao/tddl/dbsync/FetcherPerformanceTest.java b/dbsync/src/test/java/com/taobao/tddl/dbsync/FetcherPerformanceTest.java index f5af66e3..d9b6355b 100644 --- a/dbsync/src/test/java/com/taobao/tddl/dbsync/FetcherPerformanceTest.java +++ b/dbsync/src/test/java/com/taobao/tddl/dbsync/FetcherPerformanceTest.java @@ -15,9 +15,7 @@ public class FetcherPerformanceTest { DirectLogFetcher fetcher = new DirectLogFetcher(); try { Class.forName("com.mysql.jdbc.Driver"); - Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", - "root", - "hello"); + Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", "root", "hello"); Statement statement = connection.createStatement(); statement.execute("SET @master_binlog_checksum='@@global.binlog_checksum'"); statement.execute("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'"); diff --git a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java b/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java index aacace84..42821405 100644 --- a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java +++ b/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java @@ -387,7 +387,7 @@ public class CanalController { return config; } - private String getProperty(Properties properties, String key) { + public String getProperty(Properties properties, String key) { key = StringUtils.trim(key); String value = System.getProperty(key); diff --git a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalLauncher.java b/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalLauncher.java index 4388de47..081248e5 100644 --- a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalLauncher.java +++ b/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalLauncher.java @@ -6,7 +6,6 @@ import com.alibaba.otter.canal.server.CanalMQStarter; import com.alibaba.otter.canal.spi.CanalMQProducer; import java.io.FileInputStream; import java.util.Properties; - import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +56,7 @@ public class CanalLauncher { }); CanalMQProducer canalMQProducer = null; - String serverMode = properties.getProperty(CanalConstants.CANAL_SERVER_MODE, "tcp"); + String serverMode = controller.getProperty(properties, CanalConstants.CANAL_SERVER_MODE); if (serverMode.equalsIgnoreCase("kafka")) { canalMQProducer = new CanalKafkaProducer(); } else if (serverMode.equalsIgnoreCase("rocketmq")) { @@ -68,6 +67,7 @@ public class CanalLauncher { if (canalServerStarter != null) { canalServerStarter.init(); } + } } catch (Throwable e) { logger.error("## Something goes wrong when starting up the canal Server:", e); diff --git a/deployer/src/main/resources/metrics/Canal_instances_tmpl.json b/deployer/src/main/resources/metrics/Canal_instances_tmpl.json index 0d7c94d2..141810c0 100644 --- a/deployer/src/main/resources/metrics/Canal_instances_tmpl.json +++ b/deployer/src/main/resources/metrics/Canal_instances_tmpl.json @@ -1,4 +1,34 @@ { + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "5.2.2" + }, + { + "type": "panel", + "id": "graph", + "name": "Graph", + "version": "5.0.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "5.0.0" + } + ], "annotations": { "list": [ { @@ -15,8 +45,8 @@ "editable": true, "gnetId": null, "graphTooltip": 0, - "id": 8, - "iteration": 1534740332233, + "id": null, + "iteration": 1536989235272, "links": [], "panels": [ { @@ -189,7 +219,7 @@ "steppedLine": false, "targets": [ { - "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\"}[2m]) / 1024", + "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"0\"}[2m]) / 1024", "format": "time_series", "interval": "15s", "intervalFactor": 2, @@ -203,6 +233,22 @@ "intervalFactor": 2, "legendFormat": "outbound", "refId": "B" + }, + { + "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"1\"}[2m]) / 1024", + "format": "time_series", + "interval": "15s", + "intervalFactor": 2, + "legendFormat": "inbound-1", + "refId": "C" + }, + { + "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"2\"}[2m]) / 1024", + "format": "time_series", + "interval": "15s", + "intervalFactor": 2, + "legendFormat": "inbound-2", + "refId": "D" } ], "thresholds": [], @@ -399,20 +445,36 @@ "steppedLine": false, "targets": [ { - "expr": "clamp_max(rate(canal_instance_sink_blocking_time{destination=~\"$destination\"}[2m]), 1000) / 10", + "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"0\"}[2m]), 1000) / 10", "format": "time_series", "interval": "15s", "intervalFactor": 2, "legendFormat": "dump", - "refId": "A" + "refId": "B" }, { - "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\"}[2m]), 1000) / 10", + "expr": "clamp_max(rate(canal_instance_sink_blocking_time{destination=~\"$destination\"}[2m]), 1000) / 10", "format": "time_series", "interval": "15s", "intervalFactor": 2, "legendFormat": "sink", - "refId": "B" + "refId": "A" + }, + { + "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"1\"}[2m]), 1000) / 10", + "format": "time_series", + "interval": "15s", + "intervalFactor": 2, + "legendFormat": "dump-1", + "refId": "C" + }, + { + "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"2\"}[2m]), 1000) / 10", + "format": "time_series", + "interval": "15s", + "intervalFactor": 2, + "legendFormat": "dump-2", + "refId": "D" } ], "thresholds": [], @@ -465,7 +527,7 @@ }, "id": 32, "panels": [], - "title": "Server", + "title": "Throughput", "type": "row" }, { @@ -660,180 +722,6 @@ "alignLevel": null } }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "description": "Canal instance ringbuffer内未释放的events数量。", - "fill": 1, - "gridPos": { - "h": 5, - "w": 6, - "x": 12, - "y": 7 - }, - "id": 20, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "canal_instance_store_produce_seq{destination=~\"$destination\"} - canal_instance_store_consume_seq{destination=~\"$destination\"}", - "format": "time_series", - "interval": "15s", - "intervalFactor": 2, - "legendFormat": "events", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Store remain events", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "decimals": null, - "format": "none", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "decimals": null, - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "$datasource", - "description": "Canal instance ringbuffer 内未释放events占用内存。", - "fill": 1, - "gridPos": { - "h": 5, - "w": 6, - "x": 18, - "y": 7 - }, - "id": 22, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "(canal_instance_store_produce_mem{destination=~\"$destination\"} - canal_instance_store_consume_mem{destination=~\"$destination\"}) / 1024", - "format": "time_series", - "interval": "15s", - "intervalFactor": 2, - "legendFormat": "memsize", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Store remain mem", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "deckbytes", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, { "collapsed": false, "gridPos": { @@ -938,7 +826,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$datasource", + "datasource": "${DS_PROMETHEUS}", "description": "client 请求的GET与ACK包的QPS。", "fill": 1, "gridPos": { @@ -1218,6 +1106,193 @@ "align": false, "alignLevel": null } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 18 + }, + "id": 36, + "panels": [], + "title": "Store", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "$datasource", + "description": "Canal instance ringbuffer内未释放的events数量。", + "fill": 1, + "gridPos": { + "h": 5, + "w": 6, + "x": 0, + "y": 19 + }, + "id": 20, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "canal_instance_store_produce_seq{destination=~\"$destination\"} - canal_instance_store_consume_seq{destination=~\"$destination\"}", + "format": "time_series", + "interval": "15s", + "intervalFactor": 2, + "legendFormat": "events", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Store remain events", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "none", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "decimals": null, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "$datasource", + "description": "Canal instance ringbuffer 内未释放events占用内存。", + "fill": 1, + "gridPos": { + "h": 5, + "w": 6, + "x": 6, + "y": 19 + }, + "id": 22, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "(canal_instance_store_produce_mem{destination=~\"$destination\"} - canal_instance_store_consume_mem{destination=~\"$destination\"}) / 1024", + "format": "time_series", + "interval": "15s", + "intervalFactor": 2, + "legendFormat": "memsize", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Store remain mem", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "deckbytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } } ], "refresh": false, @@ -1230,9 +1305,8 @@ "list": [ { "current": { - "tags": [], - "text": "Prometheus", - "value": "Prometheus" + "text": "prometheus", + "value": "prometheus" }, "hide": 0, "label": "datasource", @@ -1245,10 +1319,7 @@ }, { "allValue": null, - "current": { - "text": "example", - "value": "example" - }, + "current": {}, "datasource": "$datasource", "hide": 0, "includeAll": false, @@ -1269,7 +1340,7 @@ ] }, "time": { - "from": "now-1h", + "from": "now-6h", "to": "now" }, "timepicker": { @@ -1300,5 +1371,5 @@ "timezone": "", "title": "Canal instances", "uid": "8vh8NGpiz", - "version": 1 + "version": 103 } \ No newline at end of file diff --git a/deployer/src/main/resources/mq.yml b/deployer/src/main/resources/mq.yml index a19a0e8b..b4bb9c29 100644 --- a/deployer/src/main/resources/mq.yml +++ b/deployer/src/main/resources/mq.yml @@ -3,17 +3,21 @@ retries: 0 batchSize: 16384 lingerMs: 1 bufferMemory: 33554432 -# canal的批次大小,单位 k,量大建议改为1M + +# Canal的batch size, 默认50K, 由于kafka最大消息体限制请勿超过1M(900K以下) canalBatchSize: 50 -filterTransactionEntry: true +# Canal get数据的超时时间, 单位: 毫秒, 空为不限超时 +canalGetTimeout: 100 +flatMessage: true canalDestinations: - canalDestination: example topic: example partition: 1 - # 一个destination可以对应多个topic - #topics: - # - topic: example - # partition: +# #对应topic分区数量 +# partitionsNum: 3 +# partitionHash: +# #库名.表名: 唯一主键 +# mytest.person: id diff --git a/deployer/src/main/resources/spring/tsdb/sql/create_table.sql b/deployer/src/main/resources/spring/tsdb/sql/create_table.sql index e5d6dbf4..322bc2b6 100644 --- a/deployer/src/main/resources/spring/tsdb/sql/create_table.sql +++ b/deployer/src/main/resources/spring/tsdb/sql/create_table.sql @@ -26,10 +26,10 @@ CREATE TABLE IF NOT EXISTS `meta_history` ( `binlog_master_id` varchar(64) DEFAULT NULL COMMENT 'binlog节点id', `binlog_timestamp` bigint(20) DEFAULT NULL COMMENT 'binlog应用的时间戳', `use_schema` varchar(1024) DEFAULT NULL COMMENT '执行sql时对应的schema', - `schema` varchar(1024) DEFAULT NULL COMMENT '对应的schema', - `table` varchar(1024) DEFAULT NULL COMMENT '对应的table', - `sql` longtext DEFAULT NULL COMMENT '执行的sql', - `type` varchar(256) DEFAULT NULL COMMENT 'sql类型', + `sql_schema` varchar(1024) DEFAULT NULL COMMENT '对应的schema', + `sql_table` varchar(1024) DEFAULT NULL COMMENT '对应的table', + `sql_text` longtext DEFAULT NULL COMMENT '执行的sql', + `sql_type` varchar(256) DEFAULT NULL COMMENT 'sql类型', `extra` text DEFAULT NULL COMMENT '额外的扩展信息', PRIMARY KEY (`id`), UNIQUE KEY binlog_file_offest(`destination`,`binlog_master_id`,`binlog_file`,`binlog_offest`), diff --git a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/BioSocketChannel.java b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/BioSocketChannel.java index f746189e..8de2acfd 100644 --- a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/BioSocketChannel.java +++ b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/BioSocketChannel.java @@ -138,6 +138,16 @@ public class BioSocketChannel implements SocketChannel { if (socket != null) { return socket.getRemoteSocketAddress(); } + + return null; + } + + public SocketAddress getLocalSocketAddress() { + Socket socket = this.socket; + if (socket != null) { + return socket.getLocalSocketAddress(); + } + return null; } diff --git a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/NettySocketChannel.java b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/NettySocketChannel.java index 782af21e..878dc605 100644 --- a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/NettySocketChannel.java +++ b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/NettySocketChannel.java @@ -216,6 +216,10 @@ public class NettySocketChannel implements SocketChannel { return channel != null ? channel.remoteAddress() : null; } + public SocketAddress getLocalSocketAddress() { + return channel != null ? channel.localAddress() : null; + } + public void close() { if (channel != null) { channel.close(); diff --git a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/SocketChannel.java b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/SocketChannel.java index 67f967ab..b67702ae 100644 --- a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/SocketChannel.java +++ b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/SocketChannel.java @@ -21,5 +21,7 @@ public interface SocketChannel { public SocketAddress getRemoteSocketAddress(); + public SocketAddress getLocalSocketAddress(); + public void close(); } diff --git a/example/src/main/java/com/alibaba/otter/canal/example/AbstractCanalClientTest.java b/example/src/main/java/com/alibaba/otter/canal/example/AbstractCanalClientTest.java index 599b5da7..9cb5eb00 100644 --- a/example/src/main/java/com/alibaba/otter/canal/example/AbstractCanalClientTest.java +++ b/example/src/main/java/com/alibaba/otter/canal/example/AbstractCanalClientTest.java @@ -5,6 +5,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import com.alibaba.otter.canal.protocol.CanalEntry; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; import org.slf4j.Logger; @@ -299,4 +300,55 @@ public class AbstractCanalClientTest { this.connector = connector; } + /** + * 获取当前Entry的 GTID信息示例 + * @param header + * @return + */ + public static String getCurrentGtid(CanalEntry.Header header) { + List props = header.getPropsList(); + if (props != null && props.size() > 0) { + for (CanalEntry.Pair pair : props) { + if ("curtGtid".equals(pair.getKey())) { + return pair.getValue(); + } + } + } + return ""; + } + + /** + * 获取当前Entry的 GTID Sequence No信息示例 + * @param header + * @return + */ + public static String getCurrentGtidSn(CanalEntry.Header header) { + List props = header.getPropsList(); + if (props != null && props.size() > 0) { + for (CanalEntry.Pair pair : props) { + if ("curtGtidSn".equals(pair.getKey())) { + return pair.getValue(); + } + } + } + return ""; + } + + /** + * 获取当前Entry的 GTID Last Committed信息示例 + * @param header + * @return + */ + public static String getCurrentGtidLct(CanalEntry.Header header) { + List props = header.getPropsList(); + if (props != null && props.size() > 0) { + for (CanalEntry.Pair pair : props) { + if ("curtGtidLct".equals(pair.getKey())) { + return pair.getValue(); + } + } + } + return ""; + } + } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/exception/PositionNotFoundException.java b/parse/src/main/java/com/alibaba/otter/canal/parse/exception/PositionNotFoundException.java index d5552a9f..67a1d72d 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/exception/PositionNotFoundException.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/exception/PositionNotFoundException.java @@ -8,23 +8,23 @@ public class PositionNotFoundException extends CanalParseException { private static final long serialVersionUID = -7382448928116244017L; - public PositionNotFoundException(String errorCode) { + public PositionNotFoundException(String errorCode){ super(errorCode); } - public PositionNotFoundException(String errorCode, Throwable cause) { + public PositionNotFoundException(String errorCode, Throwable cause){ super(errorCode, cause); } - public PositionNotFoundException(String errorCode, String errorDesc) { + public PositionNotFoundException(String errorCode, String errorDesc){ super(errorCode, errorDesc); } - public PositionNotFoundException(String errorCode, String errorDesc, Throwable cause) { + public PositionNotFoundException(String errorCode, String errorDesc, Throwable cause){ super(errorCode, errorDesc, cause); } - public PositionNotFoundException(Throwable cause) { + public PositionNotFoundException(Throwable cause){ super(cause); } } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/exception/ServerIdNotMatchException.java b/parse/src/main/java/com/alibaba/otter/canal/parse/exception/ServerIdNotMatchException.java index 05baee02..4186c6ec 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/exception/ServerIdNotMatchException.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/exception/ServerIdNotMatchException.java @@ -6,27 +6,27 @@ import com.alibaba.otter.canal.common.CanalException; * @author chengjin.lyf on 2018/8/8 下午1:07 * @since 1.0.25 */ -public class ServerIdNotMatchException extends CanalException{ +public class ServerIdNotMatchException extends CanalException { private static final long serialVersionUID = -6124989280379293953L; - public ServerIdNotMatchException(String errorCode) { + public ServerIdNotMatchException(String errorCode){ super(errorCode); } - public ServerIdNotMatchException(String errorCode, Throwable cause) { + public ServerIdNotMatchException(String errorCode, Throwable cause){ super(errorCode, cause); } - public ServerIdNotMatchException(String errorCode, String errorDesc) { + public ServerIdNotMatchException(String errorCode, String errorDesc){ super(errorCode, errorDesc); } - public ServerIdNotMatchException(String errorCode, String errorDesc, Throwable cause) { + public ServerIdNotMatchException(String errorCode, String errorDesc, Throwable cause){ super(errorCode, errorDesc, cause); } - public ServerIdNotMatchException(Throwable cause) { + public ServerIdNotMatchException(Throwable cause){ super(cause); } } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/AbstractEventParser.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/AbstractEventParser.java index fcae1317..e1f80d76 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/AbstractEventParser.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/AbstractEventParser.java @@ -19,11 +19,13 @@ import com.alibaba.otter.canal.common.AbstractCanalLifeCycle; import com.alibaba.otter.canal.common.alarm.CanalAlarmHandler; import com.alibaba.otter.canal.filter.CanalEventFilter; import com.alibaba.otter.canal.parse.CanalEventParser; +import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet; import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.exception.PositionNotFoundException; import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException; import com.alibaba.otter.canal.parse.inbound.EventTransactionBuffer.TransactionFlushCallback; +import com.alibaba.otter.canal.parse.inbound.mysql.MysqlMultiStageCoprocessor; import com.alibaba.otter.canal.parse.index.CanalLogPositionManager; import com.alibaba.otter.canal.parse.support.AuthenticationInfo; import com.alibaba.otter.canal.protocol.CanalEntry; @@ -235,12 +237,14 @@ public abstract class AbstractEventParser extends AbstractCanalLifeCycle if (parallel) { // build stage processor multiStageCoprocessor = buildMultiStageCoprocessor(); - multiStageCoprocessor.start(); - if (isGTIDMode()) { // 判断所属instance是否启用GTID模式,是的话调用ErosaConnection中GTID对应方法dump数据 - erosaConnection.dump(MysqlGTIDSet.parse(startPosition.getGtid()), multiStageCoprocessor); + GTIDSet gtidSet = MysqlGTIDSet.parse(startPosition.getGtid()); + ((MysqlMultiStageCoprocessor) multiStageCoprocessor).setGtidSet(gtidSet); + multiStageCoprocessor.start(); + erosaConnection.dump(gtidSet, multiStageCoprocessor); } else { + multiStageCoprocessor.start(); if (StringUtils.isEmpty(startPosition.getJournalName()) && startPosition.getTimestamp() != null) { erosaConnection.dump(startPosition.getTimestamp(), multiStageCoprocessor); diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/ParserExceptionHandler.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/ParserExceptionHandler.java index d0face01..3a77291d 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/ParserExceptionHandler.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/ParserExceptionHandler.java @@ -5,5 +5,6 @@ package com.alibaba.otter.canal.parse.inbound; * @since 1.0.25 */ public interface ParserExceptionHandler { + void handle(Throwable e); } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/AbstractMysqlEventParser.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/AbstractMysqlEventParser.java index 941f5ebc..00e302e6 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/AbstractMysqlEventParser.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/AbstractMysqlEventParser.java @@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory; import com.alibaba.otter.canal.filter.CanalEventFilter; import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter; import com.alibaba.otter.canal.parse.CanalEventParser; -import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet; import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.inbound.AbstractEventParser; import com.alibaba.otter.canal.parse.inbound.BinlogParser; @@ -39,6 +38,8 @@ public abstract class AbstractMysqlEventParser extends AbstractEventParser { protected boolean filterRows = false; protected boolean filterTableError = false; protected boolean useDruidDdlFilter = true; + // instance received binlog bytes + protected final AtomicLong receivedBinlogBytes = new AtomicLong(0L); private final AtomicLong eventsPublishBlockingTime = new AtomicLong(0L); protected BinlogParser buildParser() { @@ -76,13 +77,6 @@ public abstract class AbstractMysqlEventParser extends AbstractEventParser { * @return */ protected boolean processTableMeta(EntryPosition position) { - if (isGTIDMode()) { - if (binlogParser instanceof LogEventConvert) { - // 记录gtid - ((LogEventConvert) binlogParser).setGtidSet(MysqlGTIDSet.parse(position.getGtid())); - } - } - if (tableMetaTSDB != null) { if (position.getTimestamp() == null || position.getTimestamp() <= 0) { throw new CanalParseException("use gtid and TableMeta TSDB should be config timestamp > 0"); @@ -212,4 +206,8 @@ public abstract class AbstractMysqlEventParser extends AbstractEventParser { return this.eventsPublishBlockingTime; } + public AtomicLong getReceivedBinlogBytes() { + return this.receivedBinlogBytes; + } + } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java index eb3c0e31..4348dc29 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java @@ -4,6 +4,7 @@ import static com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetche import java.io.IOException; import java.net.InetSocketAddress; +import java.net.SocketAddress; import java.nio.charset.Charset; import java.util.List; import java.util.concurrent.TimeUnit; @@ -179,6 +180,8 @@ public class MysqlConnection implements ErosaConnection { fetcher.start(connector.getChannel()); LogDecoder decoder = new LogDecoder(LogEvent.UNKNOWN_EVENT, LogEvent.ENUM_END_EVENT); LogContext context = new LogContext(); + // fix bug: #890 将gtid传输至context中,供decode使用 + context.setGtidSet(gtidSet); while (fetcher.fetch()) { accumulateReceivedBytes(fetcher.limit()); LogEvent event = null; @@ -252,10 +255,18 @@ public class MysqlConnection implements ErosaConnection { private void sendRegisterSlave() throws IOException { RegisterSlaveCommandPacket cmd = new RegisterSlaveCommandPacket(); - cmd.reportHost = authInfo.getAddress().getAddress().getHostAddress(); + SocketAddress socketAddress = connector.getChannel().getLocalSocketAddress(); + if (socketAddress == null || !(socketAddress instanceof InetSocketAddress)) { + return; + } + + InetSocketAddress address = (InetSocketAddress) socketAddress; + String host = address.getHostString(); + int port = address.getPort(); + cmd.reportHost = host; + cmd.reportPort = port; cmd.reportPasswd = authInfo.getPassword(); cmd.reportUser = authInfo.getUsername(); - cmd.reportPort = authInfo.getAddress().getPort(); // 暂时先用master节点的port cmd.serverId = this.slaveId; byte[] cmdBody = cmd.toBytes(); diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java index b585d9ab..cf102d3d 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TimerTask; -import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.lang.StringUtils; import org.springframework.util.CollectionUtils; @@ -49,30 +48,27 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE private CanalHAController haController = null; - private int defaultConnectionTimeoutInSeconds = 30; // sotimeout + private int defaultConnectionTimeoutInSeconds = 30; // sotimeout private int receiveBufferSize = 64 * 1024; private int sendBufferSize = 64 * 1024; // 数据库信息 - protected AuthenticationInfo masterInfo; // 主库 - protected AuthenticationInfo standbyInfo; // 备库 + protected AuthenticationInfo masterInfo; // 主库 + protected AuthenticationInfo standbyInfo; // 备库 // binlog信息 protected EntryPosition masterPosition; protected EntryPosition standbyPosition; - private long slaveId; // 链接到mysql的slave + private long slaveId; // 链接到mysql的slave // 心跳检查信息 - private String detectingSQL; // 心跳sql - private MysqlConnection metaConnection; // 查询meta信息的链接 - private TableMetaCache tableMetaCache; // 对应meta - private int fallbackIntervalInSeconds = 60; // 切换回退时间 - private BinlogFormat[] supportBinlogFormats; // 支持的binlogFormat,如果设置会执行强校验 - private BinlogImage[] supportBinlogImages; // 支持的binlogImage,如果设置会执行强校验 + private String detectingSQL; // 心跳sql + private MysqlConnection metaConnection; // 查询meta信息的链接 + private TableMetaCache tableMetaCache; // 对应meta + private int fallbackIntervalInSeconds = 60; // 切换回退时间 + private BinlogFormat[] supportBinlogFormats; // 支持的binlogFormat,如果设置会执行强校验 + private BinlogImage[] supportBinlogImages; // 支持的binlogImage,如果设置会执行强校验 // update by yishun.chen,特殊异常处理参数 - private int dumpErrorCount = 0; // binlogDump失败异常计数 - private int dumpErrorCountThreshold = 2; // binlogDump失败异常计数阀值 - - // instance received binlog bytes - private final AtomicLong receivedBinlogBytes = new AtomicLong(0L); + private int dumpErrorCount = 0; // binlogDump失败异常计数 + private int dumpErrorCountThreshold = 2; // binlogDump失败异常计数阀值 protected ErosaConnection buildErosaConnection() { return buildMysqlConnection(this.runningInfo); @@ -907,8 +903,4 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE this.dumpErrorCountThreshold = dumpErrorCountThreshold; } - public AtomicLong getReceivedBinlogBytes() { - return this.receivedBinlogBytes; - } - } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlMultiStageCoprocessor.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlMultiStageCoprocessor.java index 722450dd..2e200e2f 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlMultiStageCoprocessor.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlMultiStageCoprocessor.java @@ -2,11 +2,13 @@ package com.alibaba.otter.canal.parse.inbound.mysql; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.LockSupport; import com.alibaba.otter.canal.common.AbstractCanalLifeCycle; import com.alibaba.otter.canal.common.utils.NamedThreadFactory; +import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.inbound.ErosaConnection; import com.alibaba.otter.canal.parse.inbound.EventTransactionBuffer; @@ -35,6 +37,7 @@ import com.taobao.tddl.dbsync.binlog.event.RowsLogEvent; import com.taobao.tddl.dbsync.binlog.event.UpdateRowsLogEvent; import com.taobao.tddl.dbsync.binlog.event.WriteRowsLogEvent; + /** * 针对解析器提供一个多阶段协同的处理 * @@ -63,6 +66,10 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement private String destination; private volatile CanalParseException exception; private AtomicLong eventsPublishBlockingTime; + private GTIDSet gtidSet; + private WorkerPool workerPool; + private BatchEventProcessor simpleParserStage; + private BatchEventProcessor sinkStoreStage; public MysqlMultiStageCoprocessor(int ringBufferSize, int parserThreadCount, LogEventConvert logEventConvert, EventTransactionBuffer transactionBuffer, String destination){ @@ -81,15 +88,15 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement ringBufferSize, new BlockingWaitStrategy()); int tc = parserThreadCount > 0 ? parserThreadCount : 1; - this.parserExecutor = Executors.newFixedThreadPool(tc, - new NamedThreadFactory("MultiStageCoprocessor-Parser-" + destination)); + this.parserExecutor = Executors.newFixedThreadPool(tc, new NamedThreadFactory("MultiStageCoprocessor-Parser-" + + destination)); this.stageExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("MultiStageCoprocessor-other-" + destination)); SequenceBarrier sequenceBarrier = disruptorMsgBuffer.newBarrier(); ExceptionHandler exceptionHandler = new SimpleFatalExceptionHandler(); // stage 2 - BatchEventProcessor simpleParserStage = new BatchEventProcessor(disruptorMsgBuffer, + simpleParserStage = new BatchEventProcessor(disruptorMsgBuffer, sequenceBarrier, new SimpleParserStage()); simpleParserStage.setExceptionHandler(exceptionHandler); @@ -101,7 +108,7 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement for (int i = 0; i < parserThreadCount; i++) { workHandlers[i] = new DmlParserStage(); } - WorkerPool workerPool = new WorkerPool(disruptorMsgBuffer, + workerPool = new WorkerPool(disruptorMsgBuffer, dmlParserSequenceBarrier, exceptionHandler, workHandlers); @@ -110,7 +117,7 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement // stage 4 SequenceBarrier sinkSequenceBarrier = disruptorMsgBuffer.newBarrier(sequence); - BatchEventProcessor sinkStoreStage = new BatchEventProcessor(disruptorMsgBuffer, + sinkStoreStage = new BatchEventProcessor(disruptorMsgBuffer, sinkSequenceBarrier, new SinkStoreStage()); sinkStoreStage.setExceptionHandler(exceptionHandler); @@ -124,14 +131,24 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement @Override public void stop() { + // fix bug #968,对于pool与 + workerPool.halt(); + simpleParserStage.halt(); + sinkStoreStage.halt(); try { parserExecutor.shutdownNow(); + while (!parserExecutor.awaitTermination(1, TimeUnit.SECONDS)) { + parserExecutor.shutdownNow(); + } } catch (Throwable e) { // ignore } try { stageExecutor.shutdownNow(); + while (!stageExecutor.awaitTermination(1, TimeUnit.SECONDS)) { + stageExecutor.shutdownNow(); + } } catch (Throwable e) { // ignore } @@ -227,6 +244,9 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement public SimpleParserStage(){ decoder = new LogDecoder(LogEvent.UNKNOWN_EVENT, LogEvent.ENUM_END_EVENT); context = new LogContext(); + if (gtidSet != null) { + context.setGtidSet(gtidSet); + } } public void onEvent(MessageEvent event, long sequence, boolean endOfBatch) throws Exception { @@ -447,4 +467,7 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement this.eventsPublishBlockingTime = eventsPublishBlockingTime; } + public void setGtidSet(GTIDSet gtidSet) { + this.gtidSet = gtidSet; + } } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/dbsync/LogEventConvert.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/dbsync/LogEventConvert.java index e161e34e..7fcd1a1f 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/dbsync/LogEventConvert.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/dbsync/LogEventConvert.java @@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory; import com.alibaba.otter.canal.common.AbstractCanalLifeCycle; import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter; -import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException; import com.alibaba.otter.canal.parse.inbound.BinlogParser; @@ -99,13 +98,6 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar private boolean filterRows = false; private boolean useDruidDdlFilter = true; - // latest gtid - private GTIDSet gtidSet; - - public LogEventConvert(GTIDSet gtidSet){ - this.gtidSet = gtidSet; - } - public LogEventConvert(){ } @@ -172,13 +164,10 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar private Entry parseGTIDLogEvent(GtidLogEvent logEvent) { LogHeader logHeader = logEvent.getHeader(); - String value = logEvent.getSid().toString() + ":" + logEvent.getGno(); Pair.Builder builder = Pair.newBuilder(); builder.setKey("gtid"); - builder.setValue(value); - if (gtidSet != null) { - gtidSet.update(value); - } + builder.setValue(logEvent.getGtidStr()); + if (logEvent.getLastCommitted() != null) { builder.setKey("lastCommitted"); builder.setValue(String.valueOf(logEvent.getLastCommitted())); @@ -556,7 +545,6 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar rowsCount++; rowChangeBuider.addRowDatas(rowDataBuilder.build()); } - TableMapLogEvent table = event.getTable(); Header header = createHeader(event.getHeader(), table.getDbName(), @@ -845,9 +833,24 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar } headerBuilder.setEventLength(logHeader.getEventLen()); // enable gtid position - if (gtidSet != null) { - String gtid = gtidSet.toString(); - headerBuilder.setGtid(gtid); + if (StringUtils.isNotEmpty(logHeader.getGtidSetStr())) { + headerBuilder.setGtid(logHeader.getGtidSetStr()); + } + // add current gtid + if (StringUtils.isNotEmpty(logHeader.getCurrentGtid())) { + Pair pair = createSpecialPair("curtGtid", logHeader.getCurrentGtid()); + headerBuilder.addProps(pair); + } + // add current gtid sequence no + if (StringUtils.isNotEmpty(logHeader.getCurrentGtidSn())) { + Pair pair = createSpecialPair("curtGtidSn", logHeader.getCurrentGtidSn()); + headerBuilder.addProps(pair); + } + + // add current gtid last committed + if (StringUtils.isNotEmpty(logHeader.getCurrentGtidLastCommit())) { + Pair pair = createSpecialPair("curtGtidLct", logHeader.getCurrentGtidLastCommit()); + headerBuilder.addProps(pair); } // add rowsCount suppport @@ -977,8 +980,4 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar public void setFilterRows(boolean filterRows) { this.filterRows = filterRows; } - - public void setGtidSet(GTIDSet gtidSet) { - this.gtidSet = gtidSet; - } } diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/ddl/SimpleDdlParser.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/ddl/SimpleDdlParser.java index 53f7de82..57d95dcc 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/ddl/SimpleDdlParser.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/ddl/SimpleDdlParser.java @@ -44,8 +44,8 @@ public class SimpleDdlParser { * http://dev.mysql.com/doc/refman/5.6/en/create-index.html * */ - public static final String CREATE_INDEX_PATTERN = "^\\s*CREATE\\s*(UNIQUE)?(FULLTEXT)?(SPATIAL)?\\s*INDEX\\s*(.*?)\\s*ON\\s*(.*?)$"; - public static final String DROP_INDEX_PATTERN = "^\\s*DROP\\s*INDEX\\s*(.*?)\\s*ON\\s*(.*?)$"; + public static final String CREATE_INDEX_PATTERN = "^\\s*CREATE\\s*(UNIQUE)?(FULLTEXT)?(SPATIAL)?\\s*INDEX\\s*(.*?)\\s+ON\\s+(.*?)$"; + public static final String DROP_INDEX_PATTERN = "^\\s*DROP\\s*INDEX\\s*(.*?)\\s+ON\\s+(.*?)$"; public static DdlResult parse(String queryString, String schmeaName) { queryString = removeComment(queryString); // 去除/* */的sql注释内容 diff --git a/parse/src/test/java/com/alibaba/otter/canal/parse/MysqlBinlogDumpPerformanceTest.java b/parse/src/test/java/com/alibaba/otter/canal/parse/MysqlBinlogDumpPerformanceTest.java index 8ca9b044..25c88764 100644 --- a/parse/src/test/java/com/alibaba/otter/canal/parse/MysqlBinlogDumpPerformanceTest.java +++ b/parse/src/test/java/com/alibaba/otter/canal/parse/MysqlBinlogDumpPerformanceTest.java @@ -20,12 +20,12 @@ public class MysqlBinlogDumpPerformanceTest { public static void main(String args[]) { final MysqlEventParser controller = new MysqlEventParser(); - final EntryPosition startPosition = new EntryPosition("mysql-bin.001699", 120L, 100L); + final EntryPosition startPosition = new EntryPosition("mysql-bin.000007", 89796293L, 100L); controller.setConnectionCharset(Charset.forName("UTF-8")); controller.setSlaveId(3344L); controller.setDetectingEnable(false); controller.setFilterQueryDml(true); - controller.setMasterInfo(new AuthenticationInfo(new InetSocketAddress("127.0.0.1", 3328), "root", "hello")); + controller.setMasterInfo(new AuthenticationInfo(new InetSocketAddress("100.81.154.142", 3306), "canal", "canal")); controller.setMasterPosition(startPosition); controller.setEnableTsdb(false); controller.setDestination("example"); diff --git a/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/SimpleDdlParserTest.java b/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/SimpleDdlParserTest.java index f2bb1ce4..ed528d86 100644 --- a/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/SimpleDdlParserTest.java +++ b/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/SimpleDdlParserTest.java @@ -225,5 +225,19 @@ public class SimpleDdlParserTest { Assert.assertNotNull(result); Assert.assertEquals("retl", result.getSchemaName()); Assert.assertEquals("retl_mark", result.getTableName()); + + // test index name contains 'on' -- version + queryString = "create index schema_new_index_version_s_idx on q_contract_account (contract_id,main_contract_id)"; + result = SimpleDdlParser.parse(queryString, "retl"); + Assert.assertNotNull(result); + Assert.assertEquals("retl", result.getSchemaName()); + Assert.assertEquals("q_contract_account", result.getTableName()); + + queryString = "drop index schema_new_index_version_s_idx on q_contract_account"; + result = SimpleDdlParser.parse(queryString, "retl"); + Assert.assertNotNull(result); + Assert.assertEquals("retl", result.getSchemaName()); + Assert.assertEquals("q_contract_account", result.getTableName()); + } } diff --git a/pom.xml b/pom.xml index 505e987e..ea1e393c 100644 --- a/pom.xml +++ b/pom.xml @@ -237,7 +237,7 @@ com.google.protobuf protobuf-java - 2.6.1 + 3.6.1 org.apache.ibatis diff --git a/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/EntryCollector.java b/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/EntryCollector.java index 9242bd11..bbd51720 100644 --- a/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/EntryCollector.java +++ b/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/EntryCollector.java @@ -53,9 +53,9 @@ public class EntryCollector extends Collector implements InstanceRegistry { for (EntryMetricsHolder emh : instances.values()) { long now = System.currentTimeMillis(); long latest = emh.latestExecTime.get(); - if (now >= latest) { - delay.addMetric(emh.destLabelValues, (now - latest)); - } + // execTime > now,delay显示为0 + long d = (now >= latest) ? (now - latest) : 0; + delay.addMetric(emh.destLabelValues, d); transactions.addMetric(emh.destLabelValues, emh.transactionCounter.doubleValue()); } mfs.add(delay); diff --git a/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/ParserCollector.java b/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/ParserCollector.java index 867e1e89..660bf1ca 100644 --- a/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/ParserCollector.java +++ b/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/ParserCollector.java @@ -1,14 +1,15 @@ package com.alibaba.otter.canal.prometheus.impl; import static com.alibaba.otter.canal.prometheus.CanalInstanceExports.DEST; -import static com.alibaba.otter.canal.prometheus.CanalInstanceExports.DEST_LABELS_LIST; + +import com.alibaba.otter.canal.parse.inbound.group.GroupEventParser; +import com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser; import io.prometheus.client.Collector; import io.prometheus.client.CounterMetricFamily; import io.prometheus.client.GaugeMetricFamily; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -19,7 +20,6 @@ import org.slf4j.LoggerFactory; import com.alibaba.otter.canal.instance.core.CanalInstance; import com.alibaba.otter.canal.parse.CanalEventParser; -import com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser; import com.alibaba.otter.canal.prometheus.InstanceRegistry; import com.google.common.base.Preconditions; @@ -34,11 +34,13 @@ public class ParserCollector extends Collector implements InstanceRegistry { private static final String RECEIVED_BINLOG = "canal_instance_received_binlog_bytes"; private static final String PARSER_MODE = "canal_instance_parser_mode"; private static final String MODE_LABEL = "parallel"; + private static final String PARSER_LABEL = "parser"; private static final String PUBLISH_BLOCKING_HELP = "Publish blocking time of dump thread in milliseconds"; private static final String RECEIVED_BINLOG_HELP = "Received binlog bytes"; private static final String MODE_HELP = "Parser mode(parallel/serial) of instance"; private final List modeLabels = Arrays.asList(DEST, MODE_LABEL); - private final ConcurrentMap instances = new ConcurrentHashMap(); + private final List parserLabels = Arrays.asList(DEST, PARSER_LABEL); + private final ConcurrentMap instances = new ConcurrentHashMap<>(); private ParserCollector() {} @@ -52,53 +54,87 @@ public class ParserCollector extends Collector implements InstanceRegistry { @Override public List collect() { - List mfs = new ArrayList(); - boolean hasParallel = false; + List mfs = new ArrayList<>(); CounterMetricFamily bytesCounter = new CounterMetricFamily(RECEIVED_BINLOG, - RECEIVED_BINLOG_HELP, DEST_LABELS_LIST); + RECEIVED_BINLOG_HELP, parserLabels); GaugeMetricFamily modeGauge = new GaugeMetricFamily(PARSER_MODE, MODE_HELP, modeLabels); CounterMetricFamily blockingCounter = new CounterMetricFamily(PUBLISH_BLOCKING, - PUBLISH_BLOCKING_HELP, DEST_LABELS_LIST); + PUBLISH_BLOCKING_HELP, parserLabels); for (ParserMetricsHolder emh : instances.values()) { - if (emh.isParallel) { - blockingCounter.addMetric(emh.destLabelValues, (emh.eventsPublishBlockingTime.doubleValue() / NANO_PER_MILLI)); - hasParallel = true; + if (emh instanceof GroupParserMetricsHolder) { + GroupParserMetricsHolder group = (GroupParserMetricsHolder) emh; + for (ParserMetricsHolder semh : group.holders) { + singleCollect(bytesCounter, blockingCounter, modeGauge, semh); + } + } + else { + singleCollect(bytesCounter, blockingCounter, modeGauge, emh); } - modeGauge.addMetric(emh.modeLabelValues, 1); - bytesCounter.addMetric(emh.destLabelValues, emh.receivedBinlogBytes.doubleValue()); - } mfs.add(bytesCounter); mfs.add(modeGauge); - if (hasParallel) { + if (!blockingCounter.samples.isEmpty()) { mfs.add(blockingCounter); } return mfs; } + private void singleCollect(CounterMetricFamily bytesCounter, CounterMetricFamily blockingCounter, GaugeMetricFamily modeGauge, ParserMetricsHolder holder) { + if (holder.isParallel) { + blockingCounter.addMetric(holder.parserLabelValues, (holder.eventsPublishBlockingTime.doubleValue() / NANO_PER_MILLI)); + } + modeGauge.addMetric(holder.modeLabelValues, 1); + bytesCounter.addMetric(holder.parserLabelValues, holder.receivedBinlogBytes.doubleValue()); + } + @Override public void register(CanalInstance instance) { final String destination = instance.getDestination(); - ParserMetricsHolder holder = new ParserMetricsHolder(); + ParserMetricsHolder holder; CanalEventParser parser = instance.getEventParser(); - if (!(parser instanceof MysqlEventParser)) { - throw new IllegalArgumentException("CanalEventParser must be MysqlEventParser"); + if (parser instanceof AbstractMysqlEventParser) { + holder = singleHolder(destination, (AbstractMysqlEventParser)parser, "0"); + } else if (parser instanceof GroupEventParser) { + holder = groupHolder(destination, (GroupEventParser)parser); + } else { + throw new IllegalArgumentException("CanalEventParser must be either AbstractMysqlEventParser or GroupEventParser."); } - MysqlEventParser mysqlParser = (MysqlEventParser) parser; - holder.destLabelValues = Collections.singletonList(destination); - holder.modeLabelValues = Arrays.asList(destination, Boolean.toString(mysqlParser.isParallel())); - holder.eventsPublishBlockingTime = mysqlParser.getEventsPublishBlockingTime(); - holder.receivedBinlogBytes = mysqlParser.getReceivedBinlogBytes(); - holder.isParallel = mysqlParser.isParallel(); - Preconditions.checkNotNull(holder.eventsPublishBlockingTime); - Preconditions.checkNotNull(holder.receivedBinlogBytes); + Preconditions.checkNotNull(holder); ParserMetricsHolder old = instances.put(destination, holder); if (old != null) { logger.warn("Remove stale ParserCollector for instance {}.", destination); } } + private ParserMetricsHolder singleHolder(String destination, AbstractMysqlEventParser parser, String id) { + ParserMetricsHolder holder = new ParserMetricsHolder(); + holder.parserLabelValues = Arrays.asList(destination, id); + holder.modeLabelValues = Arrays.asList(destination, Boolean.toString(parser.isParallel())); + holder.eventsPublishBlockingTime = parser.getEventsPublishBlockingTime(); + holder.receivedBinlogBytes = parser.getReceivedBinlogBytes(); + holder.isParallel = parser.isParallel(); + Preconditions.checkNotNull(holder.eventsPublishBlockingTime); + Preconditions.checkNotNull(holder.receivedBinlogBytes); + return holder; + } + + private GroupParserMetricsHolder groupHolder(String destination, GroupEventParser group) { + List parsers = group.getEventParsers(); + GroupParserMetricsHolder groupHolder = new GroupParserMetricsHolder(); + int num = parsers.size(); + for (int i = 0; i < num; i ++) { + CanalEventParser parser = parsers.get(i); + if (parser instanceof AbstractMysqlEventParser) { + ParserMetricsHolder single = singleHolder(destination, (AbstractMysqlEventParser)parser, Integer.toString(i + 1)); + groupHolder.holders.add(single); + } else { + logger.warn("Null or non AbstractMysqlEventParser, ignore."); + } + } + return groupHolder; + } + @Override public void unregister(CanalInstance instance) { final String destination = instance.getDestination(); @@ -106,11 +142,17 @@ public class ParserCollector extends Collector implements InstanceRegistry { } private class ParserMetricsHolder { - private List destLabelValues; + private List parserLabelValues; private List modeLabelValues; + // metrics for single parser private AtomicLong receivedBinlogBytes; private AtomicLong eventsPublishBlockingTime; + // parser mode private boolean isParallel; } + private class GroupParserMetricsHolder extends ParserMetricsHolder { + private final List holders = new ArrayList<>(); + } + } diff --git a/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/StoreCollector.java b/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/StoreCollector.java index 40186dc0..cb26f228 100644 --- a/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/StoreCollector.java +++ b/prometheus/src/main/java/com/alibaba/otter/canal/prometheus/impl/StoreCollector.java @@ -99,15 +99,13 @@ public class StoreCollector extends Collector implements InstanceRegistry { long get = Math.min(smh.getExecTime.get(), pet); long aet = Math.min(smh.ackExecTime.get(), get); long now = System.currentTimeMillis(); - if (now >= pet) { - putDelay.addMetric(smh.destLabelValues, (now - pet)); - } - if (now >= get) { - getDelay.addMetric(smh.destLabelValues, (now - get)); - } - if (now >= aet) { - ackDelay.addMetric(smh.destLabelValues, (now - aet)); - } + // execTime > now,delay显示为0 + long pd = (now >= pet) ? (now - pet) : 0; + putDelay.addMetric(smh.destLabelValues, pd); + long gd = (now >= get) ? (now - get) : 0; + getDelay.addMetric(smh.destLabelValues, gd); + long ad = (now >= aet) ? (now - aet) : 0; + ackDelay.addMetric(smh.destLabelValues, ad); putRows.addMetric(smh.destLabelValues, smh.putTableRows.doubleValue()); getRows.addMetric(smh.destLabelValues, smh.getTableRows.doubleValue()); ackRows.addMetric(smh.destLabelValues, smh.ackTableRows.doubleValue()); diff --git a/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalEntry.java b/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalEntry.java index 051d8bf6..0ff7d1ab 100644 --- a/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalEntry.java +++ b/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalEntry.java @@ -1792,7 +1792,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -1812,7 +1812,7 @@ public final class CanalEntry { getLogfileNameBytes() { Object ref = logfileName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); logfileName_ = b; @@ -1892,7 +1892,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -1912,7 +1912,7 @@ public final class CanalEntry { getServerenCodeBytes() { Object ref = serverenCode_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); serverenCode_ = b; @@ -1992,7 +1992,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -2012,7 +2012,7 @@ public final class CanalEntry { getSchemaNameBytes() { Object ref = schemaName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); schemaName_ = b; @@ -2046,7 +2046,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -2066,7 +2066,7 @@ public final class CanalEntry { getTableNameBytes() { Object ref = tableName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); tableName_ = b; @@ -2201,7 +2201,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -2221,7 +2221,7 @@ public final class CanalEntry { getGtidBytes() { Object ref = gtid_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); gtid_ = b; @@ -2671,7 +2671,7 @@ public final class CanalEntry { propsBuilder_ = null; props_ = other.props_; bitField0_ = (bitField0_ & ~0x00000800); - propsBuilder_ = + propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null; } else { @@ -2802,7 +2802,7 @@ public final class CanalEntry { getLogfileNameBytes() { Object ref = logfileName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); logfileName_ = b; @@ -2998,7 +2998,7 @@ public final class CanalEntry { getServerenCodeBytes() { Object ref = serverenCode_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); serverenCode_ = b; @@ -3197,7 +3197,7 @@ public final class CanalEntry { getSchemaNameBytes() { Object ref = schemaName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); schemaName_ = b; @@ -3297,7 +3297,7 @@ public final class CanalEntry { getTableNameBytes() { Object ref = tableName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); tableName_ = b; @@ -3808,7 +3808,7 @@ public final class CanalEntry { getGtidBytes() { Object ref = gtid_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); gtid_ = b; @@ -4328,7 +4328,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -4348,7 +4348,7 @@ public final class CanalEntry { getNameBytes() { Object ref = name_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; @@ -4506,7 +4506,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -4526,7 +4526,7 @@ public final class CanalEntry { getValueBytes() { Object ref = value_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); value_ = b; @@ -4583,7 +4583,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -4603,7 +4603,7 @@ public final class CanalEntry { getMysqlTypeBytes() { Object ref = mysqlType_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); mysqlType_ = b; @@ -4990,7 +4990,7 @@ public final class CanalEntry { propsBuilder_ = null; props_ = other.props_; bitField0_ = (bitField0_ & ~0x00000040); - propsBuilder_ = + propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null; } else { @@ -5177,7 +5177,7 @@ public final class CanalEntry { getNameBytes() { Object ref = name_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); name_ = b; @@ -5733,7 +5733,7 @@ public final class CanalEntry { getValueBytes() { Object ref = value_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); value_ = b; @@ -5881,7 +5881,7 @@ public final class CanalEntry { getMysqlTypeBytes() { Object ref = mysqlType_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); mysqlType_ = b; @@ -6644,7 +6644,7 @@ public final class CanalEntry { beforeColumnsBuilder_ = null; beforeColumns_ = other.beforeColumns_; bitField0_ = (bitField0_ & ~0x00000001); - beforeColumnsBuilder_ = + beforeColumnsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getBeforeColumnsFieldBuilder() : null; } else { @@ -6670,7 +6670,7 @@ public final class CanalEntry { afterColumnsBuilder_ = null; afterColumns_ = other.afterColumns_; bitField0_ = (bitField0_ & ~0x00000002); - afterColumnsBuilder_ = + afterColumnsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getAfterColumnsFieldBuilder() : null; } else { @@ -6696,7 +6696,7 @@ public final class CanalEntry { propsBuilder_ = null; props_ = other.props_; bitField0_ = (bitField0_ & ~0x00000004); - propsBuilder_ = + propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null; } else { @@ -8115,7 +8115,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -8135,7 +8135,7 @@ public final class CanalEntry { getSqlBytes() { Object ref = sql_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); sql_ = b; @@ -8279,7 +8279,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -8299,7 +8299,7 @@ public final class CanalEntry { getDdlSchemaNameBytes() { Object ref = ddlSchemaName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); ddlSchemaName_ = b; @@ -8648,7 +8648,7 @@ public final class CanalEntry { rowDatasBuilder_ = null; rowDatas_ = other.rowDatas_; bitField0_ = (bitField0_ & ~0x00000010); - rowDatasBuilder_ = + rowDatasBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getRowDatasFieldBuilder() : null; } else { @@ -8674,7 +8674,7 @@ public final class CanalEntry { propsBuilder_ = null; props_ = other.props_; bitField0_ = (bitField0_ & ~0x00000020); - propsBuilder_ = + propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null; } else { @@ -8904,7 +8904,7 @@ public final class CanalEntry { getSqlBytes() { Object ref = sql_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); sql_ = b; @@ -9628,7 +9628,7 @@ public final class CanalEntry { getDdlSchemaNameBytes() { Object ref = ddlSchemaName_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); ddlSchemaName_ = b; @@ -9973,7 +9973,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -9993,7 +9993,7 @@ public final class CanalEntry { getTransactionIdBytes() { Object ref = transactionId_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); transactionId_ = b; @@ -10362,7 +10362,7 @@ public final class CanalEntry { propsBuilder_ = null; props_ = other.props_; bitField0_ = (bitField0_ & ~0x00000004); - propsBuilder_ = + propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null; } else { @@ -10491,7 +10491,7 @@ public final class CanalEntry { getTransactionIdBytes() { Object ref = transactionId_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); transactionId_ = b; @@ -11174,7 +11174,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -11194,7 +11194,7 @@ public final class CanalEntry { getTransactionIdBytes() { Object ref = transactionId_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); transactionId_ = b; @@ -11526,7 +11526,7 @@ public final class CanalEntry { propsBuilder_ = null; props_ = other.props_; bitField0_ = (bitField0_ & ~0x00000004); - propsBuilder_ = + propsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getPropsFieldBuilder() : null; } else { @@ -11652,7 +11652,7 @@ public final class CanalEntry { getTransactionIdBytes() { Object ref = transactionId_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); transactionId_ = b; @@ -12188,7 +12188,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -12204,7 +12204,7 @@ public final class CanalEntry { getKeyBytes() { Object ref = key_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); key_ = b; @@ -12230,7 +12230,7 @@ public final class CanalEntry { if (ref instanceof String) { return (String) ref; } else { - com.google.protobuf.ByteString bs = + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { @@ -12246,7 +12246,7 @@ public final class CanalEntry { getValueBytes() { Object ref = value_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); value_ = b; @@ -12541,7 +12541,7 @@ public final class CanalEntry { getKeyBytes() { Object ref = key_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); key_ = b; @@ -12617,7 +12617,7 @@ public final class CanalEntry { getValueBytes() { Object ref = value_; if (ref instanceof String) { - com.google.protobuf.ByteString b = + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (String) ref); value_ = b; diff --git a/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalPacket.java b/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalPacket.java index 3909668a..1e7e4e53 100644 --- a/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalPacket.java +++ b/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalPacket.java @@ -4,9847 +4,10990 @@ package com.alibaba.otter.canal.protocol; public final class CanalPacket { + private CanalPacket() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } - private CanalPacket(){ - } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + * Protobuf enum {@code com.alibaba.otter.canal.protocol.Compression} + */ + public enum Compression + implements com.google.protobuf.ProtocolMessageEnum { + /** + * COMPRESSIONCOMPATIBLEPROTO2 = 0; + */ + COMPRESSIONCOMPATIBLEPROTO2(0), + /** + * NONE = 1; + */ + NONE(1), + /** + * ZLIB = 2; + */ + ZLIB(2), + /** + * GZIP = 3; + */ + GZIP(3), + /** + * LZF = 4; + */ + LZF(4), + UNRECOGNIZED(-1), + ; - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + /** + * COMPRESSIONCOMPATIBLEPROTO2 = 0; + */ + public static final int COMPRESSIONCOMPATIBLEPROTO2_VALUE = 0; + /** + * NONE = 1; + */ + public static final int NONE_VALUE = 1; + /** + * ZLIB = 2; + */ + public static final int ZLIB_VALUE = 2; + /** + * GZIP = 3; + */ + public static final int GZIP_VALUE = 3; + /** + * LZF = 4; + */ + public static final int LZF_VALUE = 4; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; } /** - * Protobuf enum {@code com.alibaba.otter.canal.protocol.Compression} + * @deprecated Use {@link #forNumber(int)} instead. */ - public enum Compression implements com.google.protobuf.ProtocolMessageEnum { - /** - * NONE = 1; - */ - NONE(0, 1), - /** - * ZLIB = 2; - */ - ZLIB(1, 2), - /** - * GZIP = 3; - */ - GZIP(2, 3), - /** - * LZF = 4; - */ - LZF(3, 4), ; + @java.lang.Deprecated + public static Compression valueOf(int value) { + return forNumber(value); + } - /** - * NONE = 1; - */ - public static final int NONE_VALUE = 1; - /** - * ZLIB = 2; - */ - public static final int ZLIB_VALUE = 2; - /** - * GZIP = 3; - */ - public static final int GZIP_VALUE = 3; - /** - * LZF = 4; - */ - public static final int LZF_VALUE = 4; + public static Compression forNumber(int value) { + switch (value) { + case 0: return COMPRESSIONCOMPATIBLEPROTO2; + case 1: return NONE; + case 2: return ZLIB; + case 3: return GZIP; + case 4: return LZF; + default: return null; + } + } - public final int getNumber() { - return value; - } - - public static Compression valueOf(int value) { - switch (value) { - case 1: - return NONE; - case 2: - return ZLIB; - case 3: - return GZIP; - case 4: - return LZF; - default: - return null; + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Compression> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Compression findValueByNumber(int number) { + return Compression.forNumber(number); } - } + }; - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.getDescriptor().getEnumTypes().get(0); + } - private static com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { + private static final Compression[] VALUES = values(); - public Compression findValueByNumber(int number) { - return Compression.valueOf(number); - } - }; + public static Compression valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - return getDescriptor().getValues().get(index); - } + private final int value; - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } + private Compression(int value) { + this.value = value; + } - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.getDescriptor().getEnumTypes().get(0); - } + // @@protoc_insertion_point(enum_scope:com.alibaba.otter.canal.protocol.Compression) + } - private static final Compression[] VALUES = values(); + /** + * Protobuf enum {@code com.alibaba.otter.canal.protocol.PacketType} + */ + public enum PacketType + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
    +     *compatible
    +     * 
    + * + * PACKAGETYPECOMPATIBLEPROTO2 = 0; + */ + PACKAGETYPECOMPATIBLEPROTO2(0), + /** + * HANDSHAKE = 1; + */ + HANDSHAKE(1), + /** + * CLIENTAUTHENTICATION = 2; + */ + CLIENTAUTHENTICATION(2), + /** + * ACK = 3; + */ + ACK(3), + /** + * SUBSCRIPTION = 4; + */ + SUBSCRIPTION(4), + /** + * UNSUBSCRIPTION = 5; + */ + UNSUBSCRIPTION(5), + /** + * GET = 6; + */ + GET(6), + /** + * MESSAGES = 7; + */ + MESSAGES(7), + /** + * CLIENTACK = 8; + */ + CLIENTACK(8), + /** + *
    +     * management part
    +     * 
    + * + * SHUTDOWN = 9; + */ + SHUTDOWN(9), + /** + *
    +     * integration
    +     * 
    + * + * DUMP = 10; + */ + DUMP(10), + /** + * HEARTBEAT = 11; + */ + HEARTBEAT(11), + /** + * CLIENTROLLBACK = 12; + */ + CLIENTROLLBACK(12), + UNRECOGNIZED(-1), + ; - public static Compression valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } + /** + *
    +     *compatible
    +     * 
    + * + * PACKAGETYPECOMPATIBLEPROTO2 = 0; + */ + public static final int PACKAGETYPECOMPATIBLEPROTO2_VALUE = 0; + /** + * HANDSHAKE = 1; + */ + public static final int HANDSHAKE_VALUE = 1; + /** + * CLIENTAUTHENTICATION = 2; + */ + public static final int CLIENTAUTHENTICATION_VALUE = 2; + /** + * ACK = 3; + */ + public static final int ACK_VALUE = 3; + /** + * SUBSCRIPTION = 4; + */ + public static final int SUBSCRIPTION_VALUE = 4; + /** + * UNSUBSCRIPTION = 5; + */ + public static final int UNSUBSCRIPTION_VALUE = 5; + /** + * GET = 6; + */ + public static final int GET_VALUE = 6; + /** + * MESSAGES = 7; + */ + public static final int MESSAGES_VALUE = 7; + /** + * CLIENTACK = 8; + */ + public static final int CLIENTACK_VALUE = 8; + /** + *
    +     * management part
    +     * 
    + * + * SHUTDOWN = 9; + */ + public static final int SHUTDOWN_VALUE = 9; + /** + *
    +     * integration
    +     * 
    + * + * DUMP = 10; + */ + public static final int DUMP_VALUE = 10; + /** + * HEARTBEAT = 11; + */ + public static final int HEARTBEAT_VALUE = 11; + /** + * CLIENTROLLBACK = 12; + */ + public static final int CLIENTROLLBACK_VALUE = 12; - private final int index; - private final int value; - private Compression(int index, int value){ - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.alibaba.otter.canal.protocol.Compression) + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; } /** - * Protobuf enum {@code com.alibaba.otter.canal.protocol.PacketType} + * @deprecated Use {@link #forNumber(int)} instead. */ - public enum PacketType implements com.google.protobuf.ProtocolMessageEnum { - /** - * HANDSHAKE = 1; - */ - HANDSHAKE(0, 1), - /** - * CLIENTAUTHENTICATION = 2; - */ - CLIENTAUTHENTICATION(1, 2), - /** - * ACK = 3; - */ - ACK(2, 3), - /** - * SUBSCRIPTION = 4; - */ - SUBSCRIPTION(3, 4), - /** - * UNSUBSCRIPTION = 5; - */ - UNSUBSCRIPTION(4, 5), - /** - * GET = 6; - */ - GET(5, 6), - /** - * MESSAGES = 7; - */ - MESSAGES(6, 7), - /** - * CLIENTACK = 8; - */ - CLIENTACK(7, 8), - /** - * SHUTDOWN = 9; - * - *
    -         * management part
    -         * 
    - */ - SHUTDOWN(8, 9), - /** - * DUMP = 10; - * - *
    -         * integration
    -         * 
    - */ - DUMP(9, 10), - /** - * HEARTBEAT = 11; - */ - HEARTBEAT(10, 11), - /** - * CLIENTROLLBACK = 12; - */ - CLIENTROLLBACK(11, 12), ; - - /** - * HANDSHAKE = 1; - */ - public static final int HANDSHAKE_VALUE = 1; - /** - * CLIENTAUTHENTICATION = 2; - */ - public static final int CLIENTAUTHENTICATION_VALUE = 2; - /** - * ACK = 3; - */ - public static final int ACK_VALUE = 3; - /** - * SUBSCRIPTION = 4; - */ - public static final int SUBSCRIPTION_VALUE = 4; - /** - * UNSUBSCRIPTION = 5; - */ - public static final int UNSUBSCRIPTION_VALUE = 5; - /** - * GET = 6; - */ - public static final int GET_VALUE = 6; - /** - * MESSAGES = 7; - */ - public static final int MESSAGES_VALUE = 7; - /** - * CLIENTACK = 8; - */ - public static final int CLIENTACK_VALUE = 8; - /** - * SHUTDOWN = 9; - * - *
    -         * management part
    -         * 
    - */ - public static final int SHUTDOWN_VALUE = 9; - /** - * DUMP = 10; - * - *
    -         * integration
    -         * 
    - */ - public static final int DUMP_VALUE = 10; - /** - * HEARTBEAT = 11; - */ - public static final int HEARTBEAT_VALUE = 11; - /** - * CLIENTROLLBACK = 12; - */ - public static final int CLIENTROLLBACK_VALUE = 12; - - public final int getNumber() { - return value; - } - - public static PacketType valueOf(int value) { - switch (value) { - case 1: - return HANDSHAKE; - case 2: - return CLIENTAUTHENTICATION; - case 3: - return ACK; - case 4: - return SUBSCRIPTION; - case 5: - return UNSUBSCRIPTION; - case 6: - return GET; - case 7: - return MESSAGES; - case 8: - return CLIENTACK; - case 9: - return SHUTDOWN; - case 10: - return DUMP; - case 11: - return HEARTBEAT; - case 12: - return CLIENTROLLBACK; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { - - public PacketType findValueByNumber(int number) { - return PacketType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.getDescriptor().getEnumTypes().get(1); - } - - private static final PacketType[] VALUES = values(); - - public static PacketType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private PacketType(int index, int value){ - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.alibaba.otter.canal.protocol.PacketType) + @java.lang.Deprecated + public static PacketType valueOf(int value) { + return forNumber(value); } - public interface PacketOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Packet) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - boolean hasMagicNumber(); - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - int getMagicNumber(); - - /** - * optional int32 version = 2 [default = 1]; - */ - boolean hasVersion(); - - /** - * optional int32 version = 2 [default = 1]; - */ - int getVersion(); - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - boolean hasType(); - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - com.alibaba.otter.canal.protocol.CanalPacket.PacketType getType(); - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - boolean hasCompression(); - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - com.alibaba.otter.canal.protocol.CanalPacket.Compression getCompression(); - - /** - * optional bytes body = 5; - */ - boolean hasBody(); - - /** - * optional bytes body = 5; - */ - com.google.protobuf.ByteString getBody(); + public static PacketType forNumber(int value) { + switch (value) { + case 0: return PACKAGETYPECOMPATIBLEPROTO2; + case 1: return HANDSHAKE; + case 2: return CLIENTAUTHENTICATION; + case 3: return ACK; + case 4: return SUBSCRIPTION; + case 5: return UNSUBSCRIPTION; + case 6: return GET; + case 7: return MESSAGES; + case 8: return CLIENTACK; + case 9: return SHUTDOWN; + case 10: return DUMP; + case 11: return HEARTBEAT; + case 12: return CLIENTROLLBACK; + default: return null; + } } + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + PacketType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public PacketType findValueByNumber(int number) { + return PacketType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.getDescriptor().getEnumTypes().get(1); + } + + private static final PacketType[] VALUES = values(); + + public static PacketType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private PacketType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alibaba.otter.canal.protocol.PacketType) + } + + public interface PacketOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Packet) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 magic_number = 1; + */ + int getMagicNumber(); + + /** + * int32 version = 2; + */ + int getVersion(); + + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + int getTypeValue(); + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + com.alibaba.otter.canal.protocol.CanalPacket.PacketType getType(); + + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + int getCompressionValue(); + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + com.alibaba.otter.canal.protocol.CanalPacket.Compression getCompression(); + + /** + * bytes body = 5; + */ + com.google.protobuf.ByteString getBody(); + + public com.alibaba.otter.canal.protocol.CanalPacket.Packet.MagicNumberPresentCase getMagicNumberPresentCase(); + + public com.alibaba.otter.canal.protocol.CanalPacket.Packet.VersionPresentCase getVersionPresentCase(); + + public com.alibaba.otter.canal.protocol.CanalPacket.Packet.CompressionPresentCase getCompressionPresentCase(); + } + /** + * Protobuf type {@code com.alibaba.otter.canal.protocol.Packet} + */ + public static final class Packet extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Packet) + PacketOrBuilder { + private static final long serialVersionUID = 0L; + // Use Packet.newBuilder() to construct. + private Packet(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Packet() { + type_ = 0; + body_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Packet( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + magicNumberPresentCase_ = 1; + magicNumberPresent_ = input.readInt32(); + break; + } + case 16: { + versionPresentCase_ = 2; + versionPresent_ = input.readInt32(); + break; + } + case 24: { + int rawValue = input.readEnum(); + + type_ = rawValue; + break; + } + case 32: { + int rawValue = input.readEnum(); + compressionPresentCase_ = 4; + compressionPresent_ = rawValue; + break; + } + case 42: { + + body_ = input.readBytes(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Packet.class, com.alibaba.otter.canal.protocol.CanalPacket.Packet.Builder.class); + } + + private int magicNumberPresentCase_ = 0; + private java.lang.Object magicNumberPresent_; + public enum MagicNumberPresentCase + implements com.google.protobuf.Internal.EnumLite { + MAGIC_NUMBER(1), + MAGICNUMBERPRESENT_NOT_SET(0); + private final int value; + private MagicNumberPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MagicNumberPresentCase valueOf(int value) { + return forNumber(value); + } + + public static MagicNumberPresentCase forNumber(int value) { + switch (value) { + case 1: return MAGIC_NUMBER; + case 0: return MAGICNUMBERPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public MagicNumberPresentCase + getMagicNumberPresentCase() { + return MagicNumberPresentCase.forNumber( + magicNumberPresentCase_); + } + + private int versionPresentCase_ = 0; + private java.lang.Object versionPresent_; + public enum VersionPresentCase + implements com.google.protobuf.Internal.EnumLite { + VERSION(2), + VERSIONPRESENT_NOT_SET(0); + private final int value; + private VersionPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static VersionPresentCase valueOf(int value) { + return forNumber(value); + } + + public static VersionPresentCase forNumber(int value) { + switch (value) { + case 2: return VERSION; + case 0: return VERSIONPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public VersionPresentCase + getVersionPresentCase() { + return VersionPresentCase.forNumber( + versionPresentCase_); + } + + private int compressionPresentCase_ = 0; + private java.lang.Object compressionPresent_; + public enum CompressionPresentCase + implements com.google.protobuf.Internal.EnumLite { + COMPRESSION(4), + COMPRESSIONPRESENT_NOT_SET(0); + private final int value; + private CompressionPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CompressionPresentCase valueOf(int value) { + return forNumber(value); + } + + public static CompressionPresentCase forNumber(int value) { + switch (value) { + case 4: return COMPRESSION; + case 0: return COMPRESSIONPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public CompressionPresentCase + getCompressionPresentCase() { + return CompressionPresentCase.forNumber( + compressionPresentCase_); + } + + public static final int MAGIC_NUMBER_FIELD_NUMBER = 1; + /** + * int32 magic_number = 1; + */ + public int getMagicNumber() { + if (magicNumberPresentCase_ == 1) { + return (java.lang.Integer) magicNumberPresent_; + } + return 0; + } + + public static final int VERSION_FIELD_NUMBER = 2; + /** + * int32 version = 2; + */ + public int getVersion() { + if (versionPresentCase_ == 2) { + return (java.lang.Integer) versionPresent_; + } + return 1; + } + + public static final int TYPE_FIELD_NUMBER = 3; + private int type_; + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public int getTypeValue() { + return type_; + } + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public com.alibaba.otter.canal.protocol.CanalPacket.PacketType getType() { + @SuppressWarnings("deprecation") + com.alibaba.otter.canal.protocol.CanalPacket.PacketType result = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.valueOf(type_); + return result == null ? com.alibaba.otter.canal.protocol.CanalPacket.PacketType.UNRECOGNIZED : result; + } + + public static final int COMPRESSION_FIELD_NUMBER = 4; + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public int getCompressionValue() { + if (compressionPresentCase_ == 4) { + return (java.lang.Integer) compressionPresent_; + } + return Compression.NONE_VALUE; + } + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public com.alibaba.otter.canal.protocol.CanalPacket.Compression getCompression() { + if (compressionPresentCase_ == 4) { + @SuppressWarnings("deprecation") + com.alibaba.otter.canal.protocol.CanalPacket.Compression result = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf( + (java.lang.Integer) compressionPresent_); + return result == null ? com.alibaba.otter.canal.protocol.CanalPacket.Compression.UNRECOGNIZED : result; + } + return com.alibaba.otter.canal.protocol.CanalPacket.Compression.COMPRESSIONCOMPATIBLEPROTO2; + } + + public static final int BODY_FIELD_NUMBER = 5; + private com.google.protobuf.ByteString body_; + /** + * bytes body = 5; + */ + public com.google.protobuf.ByteString getBody() { + return body_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (magicNumberPresentCase_ == 1) { + output.writeInt32( + 1, (int)((java.lang.Integer) magicNumberPresent_)); + } + if (versionPresentCase_ == 2) { + output.writeInt32( + 2, (int)((java.lang.Integer) versionPresent_)); + } + if (type_ != com.alibaba.otter.canal.protocol.CanalPacket.PacketType.PACKAGETYPECOMPATIBLEPROTO2.getNumber()) { + output.writeEnum(3, type_); + } + if (compressionPresentCase_ == 4) { + output.writeEnum(4, ((java.lang.Integer) compressionPresent_)); + } + if (!body_.isEmpty()) { + output.writeBytes(5, body_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (magicNumberPresentCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 1, (int)((java.lang.Integer) magicNumberPresent_)); + } + if (versionPresentCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 2, (int)((java.lang.Integer) versionPresent_)); + } + if (type_ != com.alibaba.otter.canal.protocol.CanalPacket.PacketType.PACKAGETYPECOMPATIBLEPROTO2.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, type_); + } + if (compressionPresentCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, ((java.lang.Integer) compressionPresent_)); + } + if (!body_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, body_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Packet)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Packet other = (com.alibaba.otter.canal.protocol.CanalPacket.Packet) obj; + + boolean result = true; + result = result && type_ == other.type_; + result = result && getBody() + .equals(other.getBody()); + result = result && getMagicNumberPresentCase().equals( + other.getMagicNumberPresentCase()); + if (!result) return false; + switch (magicNumberPresentCase_) { + case 1: + result = result && (getMagicNumber() + == other.getMagicNumber()); + break; + case 0: + default: + } + result = result && getVersionPresentCase().equals( + other.getVersionPresentCase()); + if (!result) return false; + switch (versionPresentCase_) { + case 2: + result = result && (getVersion() + == other.getVersion()); + break; + case 0: + default: + } + result = result && getCompressionPresentCase().equals( + other.getCompressionPresentCase()); + if (!result) return false; + switch (compressionPresentCase_) { + case 4: + result = result && getCompressionValue() + == other.getCompressionValue(); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + type_; + hash = (37 * hash) + BODY_FIELD_NUMBER; + hash = (53 * hash) + getBody().hashCode(); + switch (magicNumberPresentCase_) { + case 1: + hash = (37 * hash) + MAGIC_NUMBER_FIELD_NUMBER; + hash = (53 * hash) + getMagicNumber(); + break; + case 0: + default: + } + switch (versionPresentCase_) { + case 2: + hash = (37 * hash) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + break; + case 0: + default: + } + switch (compressionPresentCase_) { + case 4: + hash = (37 * hash) + COMPRESSION_FIELD_NUMBER; + hash = (53 * hash) + getCompressionValue(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Packet prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code com.alibaba.otter.canal.protocol.Packet} */ - public static final class Packet extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Packet) - PacketOrBuilder { - - // Use Packet.newBuilder() to construct. - private Packet(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Packet(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Packet defaultInstance; - - public static Packet getDefaultInstance() { - return defaultInstance; - } - - public Packet getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Packet(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - magicNumber_ = input.readInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - version_ = input.readInt32(); - break; - } - case 24: { - int rawValue = input.readEnum(); - com.alibaba.otter.canal.protocol.CanalPacket.PacketType value = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(3, rawValue); - } else { - bitField0_ |= 0x00000004; - type_ = value; - } - break; - } - case 32: { - int rawValue = input.readEnum(); - com.alibaba.otter.canal.protocol.CanalPacket.Compression value = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(4, rawValue); - } else { - bitField0_ |= 0x00000008; - compression_ = value; - } - break; - } - case 42: { - bitField0_ |= 0x00000010; - body_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Packet.class, - com.alibaba.otter.canal.protocol.CanalPacket.Packet.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Packet parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Packet(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int MAGIC_NUMBER_FIELD_NUMBER = 1; - private int magicNumber_; - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - public boolean hasMagicNumber() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - public int getMagicNumber() { - return magicNumber_; - } - - public static final int VERSION_FIELD_NUMBER = 2; - private int version_; - - /** - * optional int32 version = 2 [default = 1]; - */ - public boolean hasVersion() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional int32 version = 2 [default = 1]; - */ - public int getVersion() { - return version_; - } - - public static final int TYPE_FIELD_NUMBER = 3; - private com.alibaba.otter.canal.protocol.CanalPacket.PacketType type_; - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - public com.alibaba.otter.canal.protocol.CanalPacket.PacketType getType() { - return type_; - } - - public static final int COMPRESSION_FIELD_NUMBER = 4; - private com.alibaba.otter.canal.protocol.CanalPacket.Compression compression_; - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - public boolean hasCompression() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - public com.alibaba.otter.canal.protocol.CanalPacket.Compression getCompression() { - return compression_; - } - - public static final int BODY_FIELD_NUMBER = 5; - private com.google.protobuf.ByteString body_; - - /** - * optional bytes body = 5; - */ - public boolean hasBody() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - /** - * optional bytes body = 5; - */ - public com.google.protobuf.ByteString getBody() { - return body_; - } - - private void initFields() { - magicNumber_ = 17; - version_ = 1; - type_ = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.HANDSHAKE; - compression_ = com.alibaba.otter.canal.protocol.CanalPacket.Compression.NONE; - body_ = com.google.protobuf.ByteString.EMPTY; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, magicNumber_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, version_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeEnum(3, type_.getNumber()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeEnum(4, compression_.getNumber()); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(5, body_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, magicNumber_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, version_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, type_.getNumber()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, compression_.getNumber()); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(5, body_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Packet parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Packet prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Packet} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Packet) com.alibaba.otter.canal.protocol.CanalPacket.PacketOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Packet.class, com.alibaba.otter.canal.protocol.CanalPacket.Packet.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Packet.class, - com.alibaba.otter.canal.protocol.CanalPacket.Packet.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Packet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Packet.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - magicNumber_ = 17; - bitField0_ = (bitField0_ & ~0x00000001); - version_ = 1; - bitField0_ = (bitField0_ & ~0x00000002); - type_ = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.HANDSHAKE; - bitField0_ = (bitField0_ & ~0x00000004); - compression_ = com.alibaba.otter.canal.protocol.CanalPacket.Compression.NONE; - bitField0_ = (bitField0_ & ~0x00000008); - body_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Packet getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Packet.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Packet build() { - com.alibaba.otter.canal.protocol.CanalPacket.Packet result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Packet buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Packet result = new com.alibaba.otter.canal.protocol.CanalPacket.Packet(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.magicNumber_ = magicNumber_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.version_ = version_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.compression_ = compression_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.body_ = body_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Packet) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Packet) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Packet other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Packet.getDefaultInstance()) return this; - if (other.hasMagicNumber()) { - setMagicNumber(other.getMagicNumber()); - } - if (other.hasVersion()) { - setVersion(other.getVersion()); - } - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasCompression()) { - setCompression(other.getCompression()); - } - if (other.hasBody()) { - setBody(other.getBody()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Packet parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Packet) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private int magicNumber_ = 17; - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - public boolean hasMagicNumber() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - public int getMagicNumber() { - return magicNumber_; - } - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - public Builder setMagicNumber(int value) { - bitField0_ |= 0x00000001; - magicNumber_ = value; - onChanged(); - return this; - } - - /** - * optional int32 magic_number = 1 [default = 17]; - */ - public Builder clearMagicNumber() { - bitField0_ = (bitField0_ & ~0x00000001); - magicNumber_ = 17; - onChanged(); - return this; - } - - private int version_ = 1; - - /** - * optional int32 version = 2 [default = 1]; - */ - public boolean hasVersion() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional int32 version = 2 [default = 1]; - */ - public int getVersion() { - return version_; - } - - /** - * optional int32 version = 2 [default = 1]; - */ - public Builder setVersion(int value) { - bitField0_ |= 0x00000002; - version_ = value; - onChanged(); - return this; - } - - /** - * optional int32 version = 2 [default = 1]; - */ - public Builder clearVersion() { - bitField0_ = (bitField0_ & ~0x00000002); - version_ = 1; - onChanged(); - return this; - } - - private com.alibaba.otter.canal.protocol.CanalPacket.PacketType type_ = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.HANDSHAKE; - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - public com.alibaba.otter.canal.protocol.CanalPacket.PacketType getType() { - return type_; - } - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - public Builder setType(com.alibaba.otter.canal.protocol.CanalPacket.PacketType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - type_ = value; - onChanged(); - return this; - } - - /** - * optional .com.alibaba.otter.canal.protocol.PacketType type = 3; - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000004); - type_ = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.HANDSHAKE; - onChanged(); - return this; - } - - private com.alibaba.otter.canal.protocol.CanalPacket.Compression compression_ = com.alibaba.otter.canal.protocol.CanalPacket.Compression.NONE; - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - public boolean hasCompression() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - public com.alibaba.otter.canal.protocol.CanalPacket.Compression getCompression() { - return compression_; - } - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - public Builder setCompression(com.alibaba.otter.canal.protocol.CanalPacket.Compression value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - compression_ = value; - onChanged(); - return this; - } - - /** - * optional .com.alibaba.otter.canal.protocol.Compression compression = 4 [default = NONE]; - */ - public Builder clearCompression() { - bitField0_ = (bitField0_ & ~0x00000008); - compression_ = com.alibaba.otter.canal.protocol.CanalPacket.Compression.NONE; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString body_ = com.google.protobuf.ByteString.EMPTY; - - /** - * optional bytes body = 5; - */ - public boolean hasBody() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - /** - * optional bytes body = 5; - */ - public com.google.protobuf.ByteString getBody() { - return body_; - } - - /** - * optional bytes body = 5; - */ - public Builder setBody(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - body_ = value; - onChanged(); - return this; - } - - /** - * optional bytes body = 5; - */ - public Builder clearBody() { - bitField0_ = (bitField0_ & ~0x00000010); - body_ = getDefaultInstance().getBody(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Packet) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + type_ = 0; - static { - defaultInstance = new Packet(true); - defaultInstance.initFields(); + body_ = com.google.protobuf.ByteString.EMPTY; + + magicNumberPresentCase_ = 0; + magicNumberPresent_ = null; + versionPresentCase_ = 0; + versionPresent_ = null; + compressionPresentCase_ = 0; + compressionPresent_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Packet getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Packet.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Packet build() { + com.alibaba.otter.canal.protocol.CanalPacket.Packet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Packet) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Packet buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Packet result = new com.alibaba.otter.canal.protocol.CanalPacket.Packet(this); + if (magicNumberPresentCase_ == 1) { + result.magicNumberPresent_ = magicNumberPresent_; + } + if (versionPresentCase_ == 2) { + result.versionPresent_ = versionPresent_; + } + result.type_ = type_; + if (compressionPresentCase_ == 4) { + result.compressionPresent_ = compressionPresent_; + } + result.body_ = body_; + result.magicNumberPresentCase_ = magicNumberPresentCase_; + result.versionPresentCase_ = versionPresentCase_; + result.compressionPresentCase_ = compressionPresentCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Packet) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Packet)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Packet other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Packet.getDefaultInstance()) return this; + if (other.type_ != 0) { + setTypeValue(other.getTypeValue()); + } + if (other.getBody() != com.google.protobuf.ByteString.EMPTY) { + setBody(other.getBody()); + } + switch (other.getMagicNumberPresentCase()) { + case MAGIC_NUMBER: { + setMagicNumber(other.getMagicNumber()); + break; + } + case MAGICNUMBERPRESENT_NOT_SET: { + break; + } + } + switch (other.getVersionPresentCase()) { + case VERSION: { + setVersion(other.getVersion()); + break; + } + case VERSIONPRESENT_NOT_SET: { + break; + } + } + switch (other.getCompressionPresentCase()) { + case COMPRESSION: { + setCompressionValue(other.getCompressionValue()); + break; + } + case COMPRESSIONPRESENT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Packet parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Packet) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int magicNumberPresentCase_ = 0; + private java.lang.Object magicNumberPresent_; + public MagicNumberPresentCase + getMagicNumberPresentCase() { + return MagicNumberPresentCase.forNumber( + magicNumberPresentCase_); + } + + public Builder clearMagicNumberPresent() { + magicNumberPresentCase_ = 0; + magicNumberPresent_ = null; + onChanged(); + return this; + } + + private int versionPresentCase_ = 0; + private java.lang.Object versionPresent_; + public VersionPresentCase + getVersionPresentCase() { + return VersionPresentCase.forNumber( + versionPresentCase_); + } + + public Builder clearVersionPresent() { + versionPresentCase_ = 0; + versionPresent_ = null; + onChanged(); + return this; + } + + private int compressionPresentCase_ = 0; + private java.lang.Object compressionPresent_; + public CompressionPresentCase + getCompressionPresentCase() { + return CompressionPresentCase.forNumber( + compressionPresentCase_); + } + + public Builder clearCompressionPresent() { + compressionPresentCase_ = 0; + compressionPresent_ = null; + onChanged(); + return this; + } + + + /** + * int32 magic_number = 1; + */ + public int getMagicNumber() { + if (magicNumberPresentCase_ == 1) { + return (java.lang.Integer) magicNumberPresent_; + } + return 17; + } + /** + * int32 magic_number = 1; + */ + public Builder setMagicNumber(int value) { + magicNumberPresentCase_ = 1; + magicNumberPresent_ = value; + onChanged(); + return this; + } + /** + * int32 magic_number = 1; + */ + public Builder clearMagicNumber() { + if (magicNumberPresentCase_ == 1) { + magicNumberPresentCase_ = 0; + magicNumberPresent_ = null; + onChanged(); + } + return this; + } + + /** + * int32 version = 2; + */ + public int getVersion() { + if (versionPresentCase_ == 2) { + return (java.lang.Integer) versionPresent_; + } + return 0; + } + /** + * int32 version = 2; + */ + public Builder setVersion(int value) { + versionPresentCase_ = 2; + versionPresent_ = value; + onChanged(); + return this; + } + /** + * int32 version = 2; + */ + public Builder clearVersion() { + if (versionPresentCase_ == 2) { + versionPresentCase_ = 0; + versionPresent_ = null; + onChanged(); + } + return this; + } + + private int type_ = 0; + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public int getTypeValue() { + return type_; + } + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public Builder setTypeValue(int value) { + type_ = value; + onChanged(); + return this; + } + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public com.alibaba.otter.canal.protocol.CanalPacket.PacketType getType() { + @SuppressWarnings("deprecation") + com.alibaba.otter.canal.protocol.CanalPacket.PacketType result = com.alibaba.otter.canal.protocol.CanalPacket.PacketType.valueOf(type_); + return result == null ? com.alibaba.otter.canal.protocol.CanalPacket.PacketType.UNRECOGNIZED : result; + } + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public Builder setType(com.alibaba.otter.canal.protocol.CanalPacket.PacketType value) { + if (value == null) { + throw new NullPointerException(); + } + + type_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .com.alibaba.otter.canal.protocol.PacketType type = 3; + */ + public Builder clearType() { + + type_ = 0; + onChanged(); + return this; + } + + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public int getCompressionValue() { + if (compressionPresentCase_ == 4) { + return ((java.lang.Integer) compressionPresent_).intValue(); + } + return 0; + } + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public Builder setCompressionValue(int value) { + compressionPresentCase_ = 4; + compressionPresent_ = value; + onChanged(); + return this; + } + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public com.alibaba.otter.canal.protocol.CanalPacket.Compression getCompression() { + if (compressionPresentCase_ == 4) { + @SuppressWarnings("deprecation") + com.alibaba.otter.canal.protocol.CanalPacket.Compression result = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf( + (java.lang.Integer) compressionPresent_); + return result == null ? com.alibaba.otter.canal.protocol.CanalPacket.Compression.UNRECOGNIZED : result; + } + return com.alibaba.otter.canal.protocol.CanalPacket.Compression.COMPRESSIONCOMPATIBLEPROTO2; + } + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public Builder setCompression(com.alibaba.otter.canal.protocol.CanalPacket.Compression value) { + if (value == null) { + throw new NullPointerException(); + } + compressionPresentCase_ = 4; + compressionPresent_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .com.alibaba.otter.canal.protocol.Compression compression = 4; + */ + public Builder clearCompression() { + if (compressionPresentCase_ == 4) { + compressionPresentCase_ = 0; + compressionPresent_ = null; + onChanged(); + } + return this; + } + + private com.google.protobuf.ByteString body_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes body = 5; + */ + public com.google.protobuf.ByteString getBody() { + return body_; + } + /** + * bytes body = 5; + */ + public Builder setBody(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + body_ = value; + onChanged(); + return this; + } + /** + * bytes body = 5; + */ + public Builder clearBody() { + + body_ = getDefaultInstance().getBody(); + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Packet) } - public interface HeartBeatOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.HeartBeat) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 send_timestamp = 1; - */ - boolean hasSendTimestamp(); - - /** - * optional int64 send_timestamp = 1; - */ - long getSendTimestamp(); - - /** - * optional int64 start_timestamp = 2; - */ - boolean hasStartTimestamp(); - - /** - * optional int64 start_timestamp = 2; - */ - long getStartTimestamp(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Packet) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Packet DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Packet(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Packet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Packet parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Packet(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Packet getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface HeartBeatOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.HeartBeat) + com.google.protobuf.MessageOrBuilder { + + /** + * int64 send_timestamp = 1; + */ + long getSendTimestamp(); + + /** + * int64 start_timestamp = 2; + */ + long getStartTimestamp(); + } + /** + * Protobuf type {@code com.alibaba.otter.canal.protocol.HeartBeat} + */ + public static final class HeartBeat extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.HeartBeat) + HeartBeatOrBuilder { + private static final long serialVersionUID = 0L; + // Use HeartBeat.newBuilder() to construct. + private HeartBeat(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private HeartBeat() { + sendTimestamp_ = 0L; + startTimestamp_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private HeartBeat( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + sendTimestamp_ = input.readInt64(); + break; + } + case 16: { + + startTimestamp_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.class, com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.Builder.class); + } + + public static final int SEND_TIMESTAMP_FIELD_NUMBER = 1; + private long sendTimestamp_; + /** + * int64 send_timestamp = 1; + */ + public long getSendTimestamp() { + return sendTimestamp_; + } + + public static final int START_TIMESTAMP_FIELD_NUMBER = 2; + private long startTimestamp_; + /** + * int64 start_timestamp = 2; + */ + public long getStartTimestamp() { + return startTimestamp_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (sendTimestamp_ != 0L) { + output.writeInt64(1, sendTimestamp_); + } + if (startTimestamp_ != 0L) { + output.writeInt64(2, startTimestamp_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sendTimestamp_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, sendTimestamp_); + } + if (startTimestamp_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, startTimestamp_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat other = (com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat) obj; + + boolean result = true; + result = result && (getSendTimestamp() + == other.getSendTimestamp()); + result = result && (getStartTimestamp() + == other.getStartTimestamp()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SEND_TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getSendTimestamp()); + hash = (37 * hash) + START_TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getStartTimestamp()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code com.alibaba.otter.canal.protocol.HeartBeat} */ - public static final class HeartBeat extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.HeartBeat) - HeartBeatOrBuilder { - - // Use HeartBeat.newBuilder() to construct. - private HeartBeat(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private HeartBeat(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final HeartBeat defaultInstance; - - public static HeartBeat getDefaultInstance() { - return defaultInstance; - } - - public HeartBeat getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private HeartBeat(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - sendTimestamp_ = input.readInt64(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - startTimestamp_ = input.readInt64(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.class, - com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public HeartBeat parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new HeartBeat(input, - extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int SEND_TIMESTAMP_FIELD_NUMBER = 1; - private long sendTimestamp_; - - /** - * optional int64 send_timestamp = 1; - */ - public boolean hasSendTimestamp() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int64 send_timestamp = 1; - */ - public long getSendTimestamp() { - return sendTimestamp_; - } - - public static final int START_TIMESTAMP_FIELD_NUMBER = 2; - private long startTimestamp_; - - /** - * optional int64 start_timestamp = 2; - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional int64 start_timestamp = 2; - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - private void initFields() { - sendTimestamp_ = 0L; - startTimestamp_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt64(1, sendTimestamp_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, startTimestamp_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, sendTimestamp_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, startTimestamp_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.HeartBeat} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.HeartBeat) com.alibaba.otter.canal.protocol.CanalPacket.HeartBeatOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.class, com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.class, - com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - sendTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - startTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat build() { - com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat result = new com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.sendTimestamp_ = sendTimestamp_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.startTimestamp_ = startTimestamp_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.getDefaultInstance()) return this; - if (other.hasSendTimestamp()) { - setSendTimestamp(other.getSendTimestamp()); - } - if (other.hasStartTimestamp()) { - setStartTimestamp(other.getStartTimestamp()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private long sendTimestamp_; - - /** - * optional int64 send_timestamp = 1; - */ - public boolean hasSendTimestamp() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int64 send_timestamp = 1; - */ - public long getSendTimestamp() { - return sendTimestamp_; - } - - /** - * optional int64 send_timestamp = 1; - */ - public Builder setSendTimestamp(long value) { - bitField0_ |= 0x00000001; - sendTimestamp_ = value; - onChanged(); - return this; - } - - /** - * optional int64 send_timestamp = 1; - */ - public Builder clearSendTimestamp() { - bitField0_ = (bitField0_ & ~0x00000001); - sendTimestamp_ = 0L; - onChanged(); - return this; - } - - private long startTimestamp_; - - /** - * optional int64 start_timestamp = 2; - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional int64 start_timestamp = 2; - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - /** - * optional int64 start_timestamp = 2; - */ - public Builder setStartTimestamp(long value) { - bitField0_ |= 0x00000002; - startTimestamp_ = value; - onChanged(); - return this; - } - - /** - * optional int64 start_timestamp = 2; - */ - public Builder clearStartTimestamp() { - bitField0_ = (bitField0_ & ~0x00000002); - startTimestamp_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.HeartBeat) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + sendTimestamp_ = 0L; - static { - defaultInstance = new HeartBeat(true); - defaultInstance.initFields(); + startTimestamp_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat build() { + com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.HeartBeat) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat result = new com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat(this); + result.sendTimestamp_ = sendTimestamp_; + result.startTimestamp_ = startTimestamp_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat.getDefaultInstance()) return this; + if (other.getSendTimestamp() != 0L) { + setSendTimestamp(other.getSendTimestamp()); + } + if (other.getStartTimestamp() != 0L) { + setStartTimestamp(other.getStartTimestamp()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long sendTimestamp_ ; + /** + * int64 send_timestamp = 1; + */ + public long getSendTimestamp() { + return sendTimestamp_; + } + /** + * int64 send_timestamp = 1; + */ + public Builder setSendTimestamp(long value) { + + sendTimestamp_ = value; + onChanged(); + return this; + } + /** + * int64 send_timestamp = 1; + */ + public Builder clearSendTimestamp() { + + sendTimestamp_ = 0L; + onChanged(); + return this; + } + + private long startTimestamp_ ; + /** + * int64 start_timestamp = 2; + */ + public long getStartTimestamp() { + return startTimestamp_; + } + /** + * int64 start_timestamp = 2; + */ + public Builder setStartTimestamp(long value) { + + startTimestamp_ = value; + onChanged(); + return this; + } + /** + * int64 start_timestamp = 2; + */ + public Builder clearStartTimestamp() { + + startTimestamp_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.HeartBeat) } - public interface HandshakeOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Handshake) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - boolean hasCommunicationEncoding(); - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - java.lang.String getCommunicationEncoding(); - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - com.google.protobuf.ByteString getCommunicationEncodingBytes(); - - /** - * optional bytes seeds = 2; - */ - boolean hasSeeds(); - - /** - * optional bytes seeds = 2; - */ - com.google.protobuf.ByteString getSeeds(); - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - java.util.List getSupportedCompressionsList(); - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - int getSupportedCompressionsCount(); - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - com.alibaba.otter.canal.protocol.CanalPacket.Compression getSupportedCompressions(int index); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.HeartBeat) + private static final com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HeartBeat parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new HeartBeat(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.HeartBeat getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface HandshakeOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Handshake) + com.google.protobuf.MessageOrBuilder { + + /** + * string communication_encoding = 1; + */ + java.lang.String getCommunicationEncoding(); + /** + * string communication_encoding = 1; + */ + com.google.protobuf.ByteString + getCommunicationEncodingBytes(); + + /** + * bytes seeds = 2; + */ + com.google.protobuf.ByteString getSeeds(); + + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + int getSupportedCompressionsValue(); + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + com.alibaba.otter.canal.protocol.CanalPacket.Compression getSupportedCompressions(); + + public com.alibaba.otter.canal.protocol.CanalPacket.Handshake.CommunicationEncodingPresentCase getCommunicationEncodingPresentCase(); + } + /** + * Protobuf type {@code com.alibaba.otter.canal.protocol.Handshake} + */ + public static final class Handshake extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Handshake) + HandshakeOrBuilder { + private static final long serialVersionUID = 0L; + // Use Handshake.newBuilder() to construct. + private Handshake(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Handshake() { + seeds_ = com.google.protobuf.ByteString.EMPTY; + supportedCompressions_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Handshake( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + communicationEncodingPresentCase_ = 1; + communicationEncodingPresent_ = s; + break; + } + case 18: { + + seeds_ = input.readBytes(); + break; + } + case 24: { + int rawValue = input.readEnum(); + + supportedCompressions_ = rawValue; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Handshake.class, com.alibaba.otter.canal.protocol.CanalPacket.Handshake.Builder.class); + } + + private int communicationEncodingPresentCase_ = 0; + private java.lang.Object communicationEncodingPresent_; + public enum CommunicationEncodingPresentCase + implements com.google.protobuf.Internal.EnumLite { + COMMUNICATION_ENCODING(1), + COMMUNICATIONENCODINGPRESENT_NOT_SET(0); + private final int value; + private CommunicationEncodingPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CommunicationEncodingPresentCase valueOf(int value) { + return forNumber(value); + } + + public static CommunicationEncodingPresentCase forNumber(int value) { + switch (value) { + case 1: return COMMUNICATION_ENCODING; + case 0: return COMMUNICATIONENCODINGPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public CommunicationEncodingPresentCase + getCommunicationEncodingPresentCase() { + return CommunicationEncodingPresentCase.forNumber( + communicationEncodingPresentCase_); + } + + public static final int COMMUNICATION_ENCODING_FIELD_NUMBER = 1; + /** + * string communication_encoding = 1; + */ + public java.lang.String getCommunicationEncoding() { + java.lang.Object ref = ""; + if (communicationEncodingPresentCase_ == 1) { + ref = communicationEncodingPresent_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (communicationEncodingPresentCase_ == 1) { + communicationEncodingPresent_ = s; + } + return s; + } + } + /** + * string communication_encoding = 1; + */ + public com.google.protobuf.ByteString + getCommunicationEncodingBytes() { + java.lang.Object ref = ""; + if (communicationEncodingPresentCase_ == 1) { + ref = communicationEncodingPresent_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (communicationEncodingPresentCase_ == 1) { + communicationEncodingPresent_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SEEDS_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString seeds_; + /** + * bytes seeds = 2; + */ + public com.google.protobuf.ByteString getSeeds() { + return seeds_; + } + + public static final int SUPPORTED_COMPRESSIONS_FIELD_NUMBER = 3; + private int supportedCompressions_; + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public int getSupportedCompressionsValue() { + return supportedCompressions_; + } + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public com.alibaba.otter.canal.protocol.CanalPacket.Compression getSupportedCompressions() { + @SuppressWarnings("deprecation") + com.alibaba.otter.canal.protocol.CanalPacket.Compression result = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf(supportedCompressions_); + return result == null ? com.alibaba.otter.canal.protocol.CanalPacket.Compression.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (communicationEncodingPresentCase_ == 1) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, communicationEncodingPresent_); + } + if (!seeds_.isEmpty()) { + output.writeBytes(2, seeds_); + } + if (supportedCompressions_ != com.alibaba.otter.canal.protocol.CanalPacket.Compression.COMPRESSIONCOMPATIBLEPROTO2.getNumber()) { + output.writeEnum(3, supportedCompressions_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (communicationEncodingPresentCase_ == 1) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, communicationEncodingPresent_); + } + if (!seeds_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, seeds_); + } + if (supportedCompressions_ != com.alibaba.otter.canal.protocol.CanalPacket.Compression.COMPRESSIONCOMPATIBLEPROTO2.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, supportedCompressions_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Handshake)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Handshake other = (com.alibaba.otter.canal.protocol.CanalPacket.Handshake) obj; + + boolean result = true; + result = result && getSeeds() + .equals(other.getSeeds()); + result = result && supportedCompressions_ == other.supportedCompressions_; + result = result && getCommunicationEncodingPresentCase().equals( + other.getCommunicationEncodingPresentCase()); + if (!result) return false; + switch (communicationEncodingPresentCase_) { + case 1: + result = result && getCommunicationEncoding() + .equals(other.getCommunicationEncoding()); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SEEDS_FIELD_NUMBER; + hash = (53 * hash) + getSeeds().hashCode(); + hash = (37 * hash) + SUPPORTED_COMPRESSIONS_FIELD_NUMBER; + hash = (53 * hash) + supportedCompressions_; + switch (communicationEncodingPresentCase_) { + case 1: + hash = (37 * hash) + COMMUNICATION_ENCODING_FIELD_NUMBER; + hash = (53 * hash) + getCommunicationEncoding().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Handshake prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code com.alibaba.otter.canal.protocol.Handshake} */ - public static final class Handshake extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Handshake) - HandshakeOrBuilder { - - // Use Handshake.newBuilder() to construct. - private Handshake(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Handshake(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Handshake defaultInstance; - - public static Handshake getDefaultInstance() { - return defaultInstance; - } - - public Handshake getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Handshake(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - communicationEncoding_ = bs; - break; - } - case 18: { - bitField0_ |= 0x00000002; - seeds_ = input.readBytes(); - break; - } - case 24: { - int rawValue = input.readEnum(); - com.alibaba.otter.canal.protocol.CanalPacket.Compression value = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(3, rawValue); - } else { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - supportedCompressions_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - supportedCompressions_.add(value); - } - break; - } - case 26: { - int length = input.readRawVarint32(); - int oldLimit = input.pushLimit(length); - while (input.getBytesUntilLimit() > 0) { - int rawValue = input.readEnum(); - com.alibaba.otter.canal.protocol.CanalPacket.Compression value = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(3, rawValue); - } else { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - supportedCompressions_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - supportedCompressions_.add(value); - } - } - input.popLimit(oldLimit); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - supportedCompressions_ = java.util.Collections.unmodifiableList(supportedCompressions_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Handshake.class, - com.alibaba.otter.canal.protocol.CanalPacket.Handshake.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Handshake parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Handshake(input, - extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int COMMUNICATION_ENCODING_FIELD_NUMBER = 1; - private java.lang.Object communicationEncoding_; - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public boolean hasCommunicationEncoding() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public java.lang.String getCommunicationEncoding() { - java.lang.Object ref = communicationEncoding_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - communicationEncoding_ = s; - } - return s; - } - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public com.google.protobuf.ByteString getCommunicationEncodingBytes() { - java.lang.Object ref = communicationEncoding_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - communicationEncoding_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SEEDS_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString seeds_; - - /** - * optional bytes seeds = 2; - */ - public boolean hasSeeds() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional bytes seeds = 2; - */ - public com.google.protobuf.ByteString getSeeds() { - return seeds_; - } - - public static final int SUPPORTED_COMPRESSIONS_FIELD_NUMBER = 3; - private java.util.List supportedCompressions_; - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public java.util.List getSupportedCompressionsList() { - return supportedCompressions_; - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public int getSupportedCompressionsCount() { - return supportedCompressions_.size(); - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public com.alibaba.otter.canal.protocol.CanalPacket.Compression getSupportedCompressions(int index) { - return supportedCompressions_.get(index); - } - - private void initFields() { - communicationEncoding_ = "utf8"; - seeds_ = com.google.protobuf.ByteString.EMPTY; - supportedCompressions_ = java.util.Collections.emptyList(); - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getCommunicationEncodingBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, seeds_); - } - for (int i = 0; i < supportedCompressions_.size(); i++) { - output.writeEnum(3, supportedCompressions_.get(i).getNumber()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getCommunicationEncodingBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, seeds_); - } - { - int dataSize = 0; - for (int i = 0; i < supportedCompressions_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(supportedCompressions_.get(i) - .getNumber()); - } - size += dataSize; - size += 1 * supportedCompressions_.size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Handshake prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Handshake} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Handshake) com.alibaba.otter.canal.protocol.CanalPacket.HandshakeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Handshake.class, com.alibaba.otter.canal.protocol.CanalPacket.Handshake.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Handshake.class, - com.alibaba.otter.canal.protocol.CanalPacket.Handshake.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Handshake.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Handshake.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - communicationEncoding_ = "utf8"; - bitField0_ = (bitField0_ & ~0x00000001); - seeds_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - supportedCompressions_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Handshake getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Handshake.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Handshake build() { - com.alibaba.otter.canal.protocol.CanalPacket.Handshake result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Handshake buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Handshake result = new com.alibaba.otter.canal.protocol.CanalPacket.Handshake(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.communicationEncoding_ = communicationEncoding_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.seeds_ = seeds_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - supportedCompressions_ = java.util.Collections.unmodifiableList(supportedCompressions_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.supportedCompressions_ = supportedCompressions_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Handshake) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Handshake) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Handshake other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Handshake.getDefaultInstance()) return this; - if (other.hasCommunicationEncoding()) { - bitField0_ |= 0x00000001; - communicationEncoding_ = other.communicationEncoding_; - onChanged(); - } - if (other.hasSeeds()) { - setSeeds(other.getSeeds()); - } - if (!other.supportedCompressions_.isEmpty()) { - if (supportedCompressions_.isEmpty()) { - supportedCompressions_ = other.supportedCompressions_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureSupportedCompressionsIsMutable(); - supportedCompressions_.addAll(other.supportedCompressions_); - } - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Handshake parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Handshake) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object communicationEncoding_ = "utf8"; - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public boolean hasCommunicationEncoding() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public java.lang.String getCommunicationEncoding() { - java.lang.Object ref = communicationEncoding_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - communicationEncoding_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public com.google.protobuf.ByteString getCommunicationEncodingBytes() { - java.lang.Object ref = communicationEncoding_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - communicationEncoding_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public Builder setCommunicationEncoding(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - communicationEncoding_ = value; - onChanged(); - return this; - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public Builder clearCommunicationEncoding() { - bitField0_ = (bitField0_ & ~0x00000001); - communicationEncoding_ = getDefaultInstance().getCommunicationEncoding(); - onChanged(); - return this; - } - - /** - * optional string communication_encoding = 1 [default = "utf8"]; - */ - public Builder setCommunicationEncodingBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - communicationEncoding_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString seeds_ = com.google.protobuf.ByteString.EMPTY; - - /** - * optional bytes seeds = 2; - */ - public boolean hasSeeds() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional bytes seeds = 2; - */ - public com.google.protobuf.ByteString getSeeds() { - return seeds_; - } - - /** - * optional bytes seeds = 2; - */ - public Builder setSeeds(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - seeds_ = value; - onChanged(); - return this; - } - - /** - * optional bytes seeds = 2; - */ - public Builder clearSeeds() { - bitField0_ = (bitField0_ & ~0x00000002); - seeds_ = getDefaultInstance().getSeeds(); - onChanged(); - return this; - } - - private java.util.List supportedCompressions_ = java.util.Collections.emptyList(); - - private void ensureSupportedCompressionsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - supportedCompressions_ = new java.util.ArrayList(supportedCompressions_); - bitField0_ |= 0x00000004; - } - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public java.util.List getSupportedCompressionsList() { - return java.util.Collections.unmodifiableList(supportedCompressions_); - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public int getSupportedCompressionsCount() { - return supportedCompressions_.size(); - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public com.alibaba.otter.canal.protocol.CanalPacket.Compression getSupportedCompressions(int index) { - return supportedCompressions_.get(index); - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public Builder setSupportedCompressions(int index, - com.alibaba.otter.canal.protocol.CanalPacket.Compression value) { - if (value == null) { - throw new NullPointerException(); - } - ensureSupportedCompressionsIsMutable(); - supportedCompressions_.set(index, value); - onChanged(); - return this; - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public Builder addSupportedCompressions(com.alibaba.otter.canal.protocol.CanalPacket.Compression value) { - if (value == null) { - throw new NullPointerException(); - } - ensureSupportedCompressionsIsMutable(); - supportedCompressions_.add(value); - onChanged(); - return this; - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public Builder addAllSupportedCompressions(java.lang.Iterable values) { - ensureSupportedCompressionsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, supportedCompressions_); - onChanged(); - return this; - } - - /** - * repeated .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; - */ - public Builder clearSupportedCompressions() { - supportedCompressions_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Handshake) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + seeds_ = com.google.protobuf.ByteString.EMPTY; - static { - defaultInstance = new Handshake(true); - defaultInstance.initFields(); + supportedCompressions_ = 0; + + communicationEncodingPresentCase_ = 0; + communicationEncodingPresent_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Handshake getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Handshake.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Handshake build() { + com.alibaba.otter.canal.protocol.CanalPacket.Handshake result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Handshake) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Handshake buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Handshake result = new com.alibaba.otter.canal.protocol.CanalPacket.Handshake(this); + if (communicationEncodingPresentCase_ == 1) { + result.communicationEncodingPresent_ = communicationEncodingPresent_; + } + result.seeds_ = seeds_; + result.supportedCompressions_ = supportedCompressions_; + result.communicationEncodingPresentCase_ = communicationEncodingPresentCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Handshake) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Handshake)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Handshake other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Handshake.getDefaultInstance()) return this; + if (other.getSeeds() != com.google.protobuf.ByteString.EMPTY) { + setSeeds(other.getSeeds()); + } + if (other.supportedCompressions_ != 0) { + setSupportedCompressionsValue(other.getSupportedCompressionsValue()); + } + switch (other.getCommunicationEncodingPresentCase()) { + case COMMUNICATION_ENCODING: { + communicationEncodingPresentCase_ = 1; + communicationEncodingPresent_ = other.communicationEncodingPresent_; + onChanged(); + break; + } + case COMMUNICATIONENCODINGPRESENT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Handshake parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Handshake) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int communicationEncodingPresentCase_ = 0; + private java.lang.Object communicationEncodingPresent_; + public CommunicationEncodingPresentCase + getCommunicationEncodingPresentCase() { + return CommunicationEncodingPresentCase.forNumber( + communicationEncodingPresentCase_); + } + + public Builder clearCommunicationEncodingPresent() { + communicationEncodingPresentCase_ = 0; + communicationEncodingPresent_ = null; + onChanged(); + return this; + } + + + /** + * string communication_encoding = 1; + */ + public java.lang.String getCommunicationEncoding() { + java.lang.Object ref = ""; + if (communicationEncodingPresentCase_ == 1) { + ref = communicationEncodingPresent_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (communicationEncodingPresentCase_ == 1) { + communicationEncodingPresent_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string communication_encoding = 1; + */ + public com.google.protobuf.ByteString + getCommunicationEncodingBytes() { + java.lang.Object ref = ""; + if (communicationEncodingPresentCase_ == 1) { + ref = communicationEncodingPresent_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (communicationEncodingPresentCase_ == 1) { + communicationEncodingPresent_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string communication_encoding = 1; + */ + public Builder setCommunicationEncoding( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + communicationEncodingPresentCase_ = 1; + communicationEncodingPresent_ = value; + onChanged(); + return this; + } + /** + * string communication_encoding = 1; + */ + public Builder clearCommunicationEncoding() { + if (communicationEncodingPresentCase_ == 1) { + communicationEncodingPresentCase_ = 0; + communicationEncodingPresent_ = null; + onChanged(); + } + return this; + } + /** + * string communication_encoding = 1; + */ + public Builder setCommunicationEncodingBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + communicationEncodingPresentCase_ = 1; + communicationEncodingPresent_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString seeds_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes seeds = 2; + */ + public com.google.protobuf.ByteString getSeeds() { + return seeds_; + } + /** + * bytes seeds = 2; + */ + public Builder setSeeds(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + seeds_ = value; + onChanged(); + return this; + } + /** + * bytes seeds = 2; + */ + public Builder clearSeeds() { + + seeds_ = getDefaultInstance().getSeeds(); + onChanged(); + return this; + } + + private int supportedCompressions_ = 0; + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public int getSupportedCompressionsValue() { + return supportedCompressions_; + } + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public Builder setSupportedCompressionsValue(int value) { + supportedCompressions_ = value; + onChanged(); + return this; + } + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public com.alibaba.otter.canal.protocol.CanalPacket.Compression getSupportedCompressions() { + @SuppressWarnings("deprecation") + com.alibaba.otter.canal.protocol.CanalPacket.Compression result = com.alibaba.otter.canal.protocol.CanalPacket.Compression.valueOf(supportedCompressions_); + return result == null ? com.alibaba.otter.canal.protocol.CanalPacket.Compression.UNRECOGNIZED : result; + } + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public Builder setSupportedCompressions(com.alibaba.otter.canal.protocol.CanalPacket.Compression value) { + if (value == null) { + throw new NullPointerException(); + } + + supportedCompressions_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .com.alibaba.otter.canal.protocol.Compression supported_compressions = 3; + */ + public Builder clearSupportedCompressions() { + + supportedCompressions_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Handshake) } - public interface ClientAuthOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.ClientAuth) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string username = 1; - */ - boolean hasUsername(); - - /** - * optional string username = 1; - */ - java.lang.String getUsername(); - - /** - * optional string username = 1; - */ - com.google.protobuf.ByteString getUsernameBytes(); - - /** - * optional bytes password = 2; - * - *
    -         * hashed password with seeds from Handshake message
    -         * 
    - */ - boolean hasPassword(); - - /** - * optional bytes password = 2; - * - *
    -         * hashed password with seeds from Handshake message
    -         * 
    - */ - com.google.protobuf.ByteString getPassword(); - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - boolean hasNetReadTimeout(); - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - int getNetReadTimeout(); - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - boolean hasNetWriteTimeout(); - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - int getNetWriteTimeout(); - - /** - * optional string destination = 5; - */ - boolean hasDestination(); - - /** - * optional string destination = 5; - */ - java.lang.String getDestination(); - - /** - * optional string destination = 5; - */ - com.google.protobuf.ByteString getDestinationBytes(); - - /** - * optional string client_id = 6; - */ - boolean hasClientId(); - - /** - * optional string client_id = 6; - */ - java.lang.String getClientId(); - - /** - * optional string client_id = 6; - */ - com.google.protobuf.ByteString getClientIdBytes(); - - /** - * optional string filter = 7; - */ - boolean hasFilter(); - - /** - * optional string filter = 7; - */ - java.lang.String getFilter(); - - /** - * optional string filter = 7; - */ - com.google.protobuf.ByteString getFilterBytes(); - - /** - * optional int64 start_timestamp = 8; - */ - boolean hasStartTimestamp(); - - /** - * optional int64 start_timestamp = 8; - */ - long getStartTimestamp(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Handshake) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Handshake DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Handshake(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Handshake getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Handshake parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Handshake(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Handshake getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ClientAuthOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.ClientAuth) + com.google.protobuf.MessageOrBuilder { + /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAuth} + * string username = 1; + */ + java.lang.String getUsername(); + /** + * string username = 1; + */ + com.google.protobuf.ByteString + getUsernameBytes(); + + /** + *
    +     * hashed password with seeds from Handshake message
    +     * 
    * + * bytes password = 2; + */ + com.google.protobuf.ByteString getPassword(); + + /** + *
    +     * in seconds
    +     * 
    + * + * int32 net_read_timeout = 3; + */ + int getNetReadTimeout(); + + /** + *
    +     * in seconds
    +     * 
    + * + * int32 net_write_timeout = 4; + */ + int getNetWriteTimeout(); + + /** + * string destination = 5; + */ + java.lang.String getDestination(); + /** + * string destination = 5; + */ + com.google.protobuf.ByteString + getDestinationBytes(); + + /** + * string client_id = 6; + */ + java.lang.String getClientId(); + /** + * string client_id = 6; + */ + com.google.protobuf.ByteString + getClientIdBytes(); + + /** + * string filter = 7; + */ + java.lang.String getFilter(); + /** + * string filter = 7; + */ + com.google.protobuf.ByteString + getFilterBytes(); + + /** + * int64 start_timestamp = 8; + */ + long getStartTimestamp(); + + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.NetReadTimeoutPresentCase getNetReadTimeoutPresentCase(); + + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.NetWriteTimeoutPresentCase getNetWriteTimeoutPresentCase(); + } + /** + *
    +   * client authentication
    +   * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAuth} + */ + public static final class ClientAuth extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.ClientAuth) + ClientAuthOrBuilder { + private static final long serialVersionUID = 0L; + // Use ClientAuth.newBuilder() to construct. + private ClientAuth(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClientAuth() { + username_ = ""; + password_ = com.google.protobuf.ByteString.EMPTY; + destination_ = ""; + clientId_ = ""; + filter_ = ""; + startTimestamp_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClientAuth( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + username_ = s; + break; + } + case 18: { + + password_ = input.readBytes(); + break; + } + case 24: { + netReadTimeoutPresentCase_ = 3; + netReadTimeoutPresent_ = input.readInt32(); + break; + } + case 32: { + netWriteTimeoutPresentCase_ = 4; + netWriteTimeoutPresent_ = input.readInt32(); + break; + } + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + + destination_ = s; + break; + } + case 50: { + java.lang.String s = input.readStringRequireUtf8(); + + clientId_ = s; + break; + } + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + case 64: { + + startTimestamp_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.class, com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.Builder.class); + } + + private int netReadTimeoutPresentCase_ = 0; + private java.lang.Object netReadTimeoutPresent_; + public enum NetReadTimeoutPresentCase + implements com.google.protobuf.Internal.EnumLite { + NET_READ_TIMEOUT(3), + NETREADTIMEOUTPRESENT_NOT_SET(0); + private final int value; + private NetReadTimeoutPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static NetReadTimeoutPresentCase valueOf(int value) { + return forNumber(value); + } + + public static NetReadTimeoutPresentCase forNumber(int value) { + switch (value) { + case 3: return NET_READ_TIMEOUT; + case 0: return NETREADTIMEOUTPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public NetReadTimeoutPresentCase + getNetReadTimeoutPresentCase() { + return NetReadTimeoutPresentCase.forNumber( + netReadTimeoutPresentCase_); + } + + private int netWriteTimeoutPresentCase_ = 0; + private java.lang.Object netWriteTimeoutPresent_; + public enum NetWriteTimeoutPresentCase + implements com.google.protobuf.Internal.EnumLite { + NET_WRITE_TIMEOUT(4), + NETWRITETIMEOUTPRESENT_NOT_SET(0); + private final int value; + private NetWriteTimeoutPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static NetWriteTimeoutPresentCase valueOf(int value) { + return forNumber(value); + } + + public static NetWriteTimeoutPresentCase forNumber(int value) { + switch (value) { + case 4: return NET_WRITE_TIMEOUT; + case 0: return NETWRITETIMEOUTPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public NetWriteTimeoutPresentCase + getNetWriteTimeoutPresentCase() { + return NetWriteTimeoutPresentCase.forNumber( + netWriteTimeoutPresentCase_); + } + + public static final int USERNAME_FIELD_NUMBER = 1; + private volatile java.lang.Object username_; + /** + * string username = 1; + */ + public java.lang.String getUsername() { + java.lang.Object ref = username_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + username_ = s; + return s; + } + } + /** + * string username = 1; + */ + public com.google.protobuf.ByteString + getUsernameBytes() { + java.lang.Object ref = username_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + username_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PASSWORD_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString password_; + /** + *
    +     * hashed password with seeds from Handshake message
    +     * 
    + * + * bytes password = 2; + */ + public com.google.protobuf.ByteString getPassword() { + return password_; + } + + public static final int NET_READ_TIMEOUT_FIELD_NUMBER = 3; + /** + *
    +     * in seconds
    +     * 
    + * + * int32 net_read_timeout = 3; + */ + public int getNetReadTimeout() { + if (netReadTimeoutPresentCase_ == 3) { + return (java.lang.Integer) netReadTimeoutPresent_; + } + return 0; + } + + public static final int NET_WRITE_TIMEOUT_FIELD_NUMBER = 4; + /** + *
    +     * in seconds
    +     * 
    + * + * int32 net_write_timeout = 4; + */ + public int getNetWriteTimeout() { + if (netWriteTimeoutPresentCase_ == 4) { + return (java.lang.Integer) netWriteTimeoutPresent_; + } + return 0; + } + + public static final int DESTINATION_FIELD_NUMBER = 5; + private volatile java.lang.Object destination_; + /** + * string destination = 5; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } + } + /** + * string destination = 5; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_ID_FIELD_NUMBER = 6; + private volatile java.lang.Object clientId_; + /** + * string client_id = 6; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + /** + * string client_id = 6; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 7; + private volatile java.lang.Object filter_; + /** + * string filter = 7; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * string filter = 7; + */ + public com.google.protobuf.ByteString + getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int START_TIMESTAMP_FIELD_NUMBER = 8; + private long startTimestamp_; + /** + * int64 start_timestamp = 8; + */ + public long getStartTimestamp() { + return startTimestamp_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getUsernameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, username_); + } + if (!password_.isEmpty()) { + output.writeBytes(2, password_); + } + if (netReadTimeoutPresentCase_ == 3) { + output.writeInt32( + 3, (int)((java.lang.Integer) netReadTimeoutPresent_)); + } + if (netWriteTimeoutPresentCase_ == 4) { + output.writeInt32( + 4, (int)((java.lang.Integer) netWriteTimeoutPresent_)); + } + if (!getDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, destination_); + } + if (!getClientIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, clientId_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, filter_); + } + if (startTimestamp_ != 0L) { + output.writeInt64(8, startTimestamp_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUsernameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, username_); + } + if (!password_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, password_); + } + if (netReadTimeoutPresentCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 3, (int)((java.lang.Integer) netReadTimeoutPresent_)); + } + if (netWriteTimeoutPresentCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 4, (int)((java.lang.Integer) netWriteTimeoutPresent_)); + } + if (!getDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, destination_); + } + if (!getClientIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, clientId_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, filter_); + } + if (startTimestamp_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(8, startTimestamp_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth other = (com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth) obj; + + boolean result = true; + result = result && getUsername() + .equals(other.getUsername()); + result = result && getPassword() + .equals(other.getPassword()); + result = result && getDestination() + .equals(other.getDestination()); + result = result && getClientId() + .equals(other.getClientId()); + result = result && getFilter() + .equals(other.getFilter()); + result = result && (getStartTimestamp() + == other.getStartTimestamp()); + result = result && getNetReadTimeoutPresentCase().equals( + other.getNetReadTimeoutPresentCase()); + if (!result) return false; + switch (netReadTimeoutPresentCase_) { + case 3: + result = result && (getNetReadTimeout() + == other.getNetReadTimeout()); + break; + case 0: + default: + } + result = result && getNetWriteTimeoutPresentCase().equals( + other.getNetWriteTimeoutPresentCase()); + if (!result) return false; + switch (netWriteTimeoutPresentCase_) { + case 4: + result = result && (getNetWriteTimeout() + == other.getNetWriteTimeout()); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + USERNAME_FIELD_NUMBER; + hash = (53 * hash) + getUsername().hashCode(); + hash = (37 * hash) + PASSWORD_FIELD_NUMBER; + hash = (53 * hash) + getPassword().hashCode(); + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (37 * hash) + START_TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getStartTimestamp()); + switch (netReadTimeoutPresentCase_) { + case 3: + hash = (37 * hash) + NET_READ_TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getNetReadTimeout(); + break; + case 0: + default: + } + switch (netWriteTimeoutPresentCase_) { + case 4: + hash = (37 * hash) + NET_WRITE_TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getNetWriteTimeout(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** *
          * client authentication
          * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAuth} */ - public static final class ClientAuth extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.ClientAuth) - ClientAuthOrBuilder { - - // Use ClientAuth.newBuilder() to construct. - private ClientAuth(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private ClientAuth(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final ClientAuth defaultInstance; - - public static ClientAuth getDefaultInstance() { - return defaultInstance; - } - - public ClientAuth getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ClientAuth(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - username_ = bs; - break; - } - case 18: { - bitField0_ |= 0x00000002; - password_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - netReadTimeout_ = input.readInt32(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - netWriteTimeout_ = input.readInt32(); - break; - } - case 42: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000010; - destination_ = bs; - break; - } - case 50: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000020; - clientId_ = bs; - break; - } - case 58: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000040; - filter_ = bs; - break; - } - case 64: { - bitField0_ |= 0x00000080; - startTimestamp_ = input.readInt64(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.class, - com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public ClientAuth parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ClientAuth(input, - extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int USERNAME_FIELD_NUMBER = 1; - private java.lang.Object username_; - - /** - * optional string username = 1; - */ - public boolean hasUsername() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string username = 1; - */ - public java.lang.String getUsername() { - java.lang.Object ref = username_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - username_ = s; - } - return s; - } - } - - /** - * optional string username = 1; - */ - public com.google.protobuf.ByteString getUsernameBytes() { - java.lang.Object ref = username_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - username_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PASSWORD_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString password_; - - /** - * optional bytes password = 2; - * - *
    -         * hashed password with seeds from Handshake message
    -         * 
    - */ - public boolean hasPassword() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional bytes password = 2; - * - *
    -         * hashed password with seeds from Handshake message
    -         * 
    - */ - public com.google.protobuf.ByteString getPassword() { - return password_; - } - - public static final int NET_READ_TIMEOUT_FIELD_NUMBER = 3; - private int netReadTimeout_; - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - public boolean hasNetReadTimeout() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - public int getNetReadTimeout() { - return netReadTimeout_; - } - - public static final int NET_WRITE_TIMEOUT_FIELD_NUMBER = 4; - private int netWriteTimeout_; - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - public boolean hasNetWriteTimeout() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -         * in seconds
    -         * 
    - */ - public int getNetWriteTimeout() { - return netWriteTimeout_; - } - - public static final int DESTINATION_FIELD_NUMBER = 5; - private java.lang.Object destination_; - - /** - * optional string destination = 5; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - /** - * optional string destination = 5; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } - } - - /** - * optional string destination = 5; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CLIENT_ID_FIELD_NUMBER = 6; - private java.lang.Object clientId_; - - /** - * optional string client_id = 6; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - /** - * optional string client_id = 6; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } - } - - /** - * optional string client_id = 6; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int FILTER_FIELD_NUMBER = 7; - private java.lang.Object filter_; - - /** - * optional string filter = 7; - */ - public boolean hasFilter() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - /** - * optional string filter = 7; - */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - filter_ = s; - } - return s; - } - } - - /** - * optional string filter = 7; - */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int START_TIMESTAMP_FIELD_NUMBER = 8; - private long startTimestamp_; - - /** - * optional int64 start_timestamp = 8; - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - - /** - * optional int64 start_timestamp = 8; - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - private void initFields() { - username_ = ""; - password_ = com.google.protobuf.ByteString.EMPTY; - netReadTimeout_ = 0; - netWriteTimeout_ = 0; - destination_ = ""; - clientId_ = ""; - filter_ = ""; - startTimestamp_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getUsernameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, password_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt32(3, netReadTimeout_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(4, netWriteTimeout_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(5, getDestinationBytes()); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(6, getClientIdBytes()); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBytes(7, getFilterBytes()); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - output.writeInt64(8, startTimestamp_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getUsernameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, password_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, netReadTimeout_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, netWriteTimeout_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(5, getDestinationBytes()); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(6, getClientIdBytes()); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getFilterBytes()); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(8, startTimestamp_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAuth} - * - *
    -         * client authentication
    -         * 
    - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.ClientAuth) com.alibaba.otter.canal.protocol.CanalPacket.ClientAuthOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.class, - com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.Builder.class); - } - - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - username_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - password_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - netReadTimeout_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - netWriteTimeout_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - destination_ = ""; - bitField0_ = (bitField0_ & ~0x00000010); - clientId_ = ""; - bitField0_ = (bitField0_ & ~0x00000020); - filter_ = ""; - bitField0_ = (bitField0_ & ~0x00000040); - startTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000080); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth build() { - com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth result = new com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.username_ = username_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.password_ = password_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.netReadTimeout_ = netReadTimeout_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.netWriteTimeout_ = netWriteTimeout_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.destination_ = destination_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.clientId_ = clientId_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.filter_ = filter_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000080; - } - result.startTimestamp_ = startTimestamp_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.getDefaultInstance()) return this; - if (other.hasUsername()) { - bitField0_ |= 0x00000001; - username_ = other.username_; - onChanged(); - } - if (other.hasPassword()) { - setPassword(other.getPassword()); - } - if (other.hasNetReadTimeout()) { - setNetReadTimeout(other.getNetReadTimeout()); - } - if (other.hasNetWriteTimeout()) { - setNetWriteTimeout(other.getNetWriteTimeout()); - } - if (other.hasDestination()) { - bitField0_ |= 0x00000010; - destination_ = other.destination_; - onChanged(); - } - if (other.hasClientId()) { - bitField0_ |= 0x00000020; - clientId_ = other.clientId_; - onChanged(); - } - if (other.hasFilter()) { - bitField0_ |= 0x00000040; - filter_ = other.filter_; - onChanged(); - } - if (other.hasStartTimestamp()) { - setStartTimestamp(other.getStartTimestamp()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object username_ = ""; - - /** - * optional string username = 1; - */ - public boolean hasUsername() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string username = 1; - */ - public java.lang.String getUsername() { - java.lang.Object ref = username_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - username_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string username = 1; - */ - public com.google.protobuf.ByteString getUsernameBytes() { - java.lang.Object ref = username_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - username_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string username = 1; - */ - public Builder setUsername(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - username_ = value; - onChanged(); - return this; - } - - /** - * optional string username = 1; - */ - public Builder clearUsername() { - bitField0_ = (bitField0_ & ~0x00000001); - username_ = getDefaultInstance().getUsername(); - onChanged(); - return this; - } - - /** - * optional string username = 1; - */ - public Builder setUsernameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - username_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString password_ = com.google.protobuf.ByteString.EMPTY; - - /** - * optional bytes password = 2; - * - *
    -             * hashed password with seeds from Handshake message
    -             * 
    - */ - public boolean hasPassword() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional bytes password = 2; - * - *
    -             * hashed password with seeds from Handshake message
    -             * 
    - */ - public com.google.protobuf.ByteString getPassword() { - return password_; - } - - /** - * optional bytes password = 2; - * - *
    -             * hashed password with seeds from Handshake message
    -             * 
    - */ - public Builder setPassword(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - password_ = value; - onChanged(); - return this; - } - - /** - * optional bytes password = 2; - * - *
    -             * hashed password with seeds from Handshake message
    -             * 
    - */ - public Builder clearPassword() { - bitField0_ = (bitField0_ & ~0x00000002); - password_ = getDefaultInstance().getPassword(); - onChanged(); - return this; - } - - private int netReadTimeout_; - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public boolean hasNetReadTimeout() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public int getNetReadTimeout() { - return netReadTimeout_; - } - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public Builder setNetReadTimeout(int value) { - bitField0_ |= 0x00000004; - netReadTimeout_ = value; - onChanged(); - return this; - } - - /** - * optional int32 net_read_timeout = 3 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public Builder clearNetReadTimeout() { - bitField0_ = (bitField0_ & ~0x00000004); - netReadTimeout_ = 0; - onChanged(); - return this; - } - - private int netWriteTimeout_; - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public boolean hasNetWriteTimeout() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public int getNetWriteTimeout() { - return netWriteTimeout_; - } - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public Builder setNetWriteTimeout(int value) { - bitField0_ |= 0x00000008; - netWriteTimeout_ = value; - onChanged(); - return this; - } - - /** - * optional int32 net_write_timeout = 4 [default = 0]; - * - *
    -             * in seconds
    -             * 
    - */ - public Builder clearNetWriteTimeout() { - bitField0_ = (bitField0_ & ~0x00000008); - netWriteTimeout_ = 0; - onChanged(); - return this; - } - - private java.lang.Object destination_ = ""; - - /** - * optional string destination = 5; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - /** - * optional string destination = 5; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string destination = 5; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string destination = 5; - */ - public Builder setDestination(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - destination_ = value; - onChanged(); - return this; - } - - /** - * optional string destination = 5; - */ - public Builder clearDestination() { - bitField0_ = (bitField0_ & ~0x00000010); - destination_ = getDefaultInstance().getDestination(); - onChanged(); - return this; - } - - /** - * optional string destination = 5; - */ - public Builder setDestinationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - destination_ = value; - onChanged(); - return this; - } - - private java.lang.Object clientId_ = ""; - - /** - * optional string client_id = 6; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - /** - * optional string client_id = 6; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string client_id = 6; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string client_id = 6; - */ - public Builder setClientId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - clientId_ = value; - onChanged(); - return this; - } - - /** - * optional string client_id = 6; - */ - public Builder clearClientId() { - bitField0_ = (bitField0_ & ~0x00000020); - clientId_ = getDefaultInstance().getClientId(); - onChanged(); - return this; - } - - /** - * optional string client_id = 6; - */ - public Builder setClientIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - clientId_ = value; - onChanged(); - return this; - } - - private java.lang.Object filter_ = ""; - - /** - * optional string filter = 7; - */ - public boolean hasFilter() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - /** - * optional string filter = 7; - */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - filter_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string filter = 7; - */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string filter = 7; - */ - public Builder setFilter(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - filter_ = value; - onChanged(); - return this; - } - - /** - * optional string filter = 7; - */ - public Builder clearFilter() { - bitField0_ = (bitField0_ & ~0x00000040); - filter_ = getDefaultInstance().getFilter(); - onChanged(); - return this; - } - - /** - * optional string filter = 7; - */ - public Builder setFilterBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - filter_ = value; - onChanged(); - return this; - } - - private long startTimestamp_; - - /** - * optional int64 start_timestamp = 8; - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - - /** - * optional int64 start_timestamp = 8; - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - /** - * optional int64 start_timestamp = 8; - */ - public Builder setStartTimestamp(long value) { - bitField0_ |= 0x00000080; - startTimestamp_ = value; - onChanged(); - return this; - } - - /** - * optional int64 start_timestamp = 8; - */ - public Builder clearStartTimestamp() { - bitField0_ = (bitField0_ & ~0x00000080); - startTimestamp_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.ClientAuth) + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.class, com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.Builder.class); + } + + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + username_ = ""; - static { - defaultInstance = new ClientAuth(true); - defaultInstance.initFields(); + password_ = com.google.protobuf.ByteString.EMPTY; + + destination_ = ""; + + clientId_ = ""; + + filter_ = ""; + + startTimestamp_ = 0L; + + netReadTimeoutPresentCase_ = 0; + netReadTimeoutPresent_ = null; + netWriteTimeoutPresentCase_ = 0; + netWriteTimeoutPresent_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth build() { + com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.ClientAuth) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth result = new com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth(this); + result.username_ = username_; + result.password_ = password_; + if (netReadTimeoutPresentCase_ == 3) { + result.netReadTimeoutPresent_ = netReadTimeoutPresent_; + } + if (netWriteTimeoutPresentCase_ == 4) { + result.netWriteTimeoutPresent_ = netWriteTimeoutPresent_; + } + result.destination_ = destination_; + result.clientId_ = clientId_; + result.filter_ = filter_; + result.startTimestamp_ = startTimestamp_; + result.netReadTimeoutPresentCase_ = netReadTimeoutPresentCase_; + result.netWriteTimeoutPresentCase_ = netWriteTimeoutPresentCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth.getDefaultInstance()) return this; + if (!other.getUsername().isEmpty()) { + username_ = other.username_; + onChanged(); + } + if (other.getPassword() != com.google.protobuf.ByteString.EMPTY) { + setPassword(other.getPassword()); + } + if (!other.getDestination().isEmpty()) { + destination_ = other.destination_; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + if (other.getStartTimestamp() != 0L) { + setStartTimestamp(other.getStartTimestamp()); + } + switch (other.getNetReadTimeoutPresentCase()) { + case NET_READ_TIMEOUT: { + setNetReadTimeout(other.getNetReadTimeout()); + break; + } + case NETREADTIMEOUTPRESENT_NOT_SET: { + break; + } + } + switch (other.getNetWriteTimeoutPresentCase()) { + case NET_WRITE_TIMEOUT: { + setNetWriteTimeout(other.getNetWriteTimeout()); + break; + } + case NETWRITETIMEOUTPRESENT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int netReadTimeoutPresentCase_ = 0; + private java.lang.Object netReadTimeoutPresent_; + public NetReadTimeoutPresentCase + getNetReadTimeoutPresentCase() { + return NetReadTimeoutPresentCase.forNumber( + netReadTimeoutPresentCase_); + } + + public Builder clearNetReadTimeoutPresent() { + netReadTimeoutPresentCase_ = 0; + netReadTimeoutPresent_ = null; + onChanged(); + return this; + } + + private int netWriteTimeoutPresentCase_ = 0; + private java.lang.Object netWriteTimeoutPresent_; + public NetWriteTimeoutPresentCase + getNetWriteTimeoutPresentCase() { + return NetWriteTimeoutPresentCase.forNumber( + netWriteTimeoutPresentCase_); + } + + public Builder clearNetWriteTimeoutPresent() { + netWriteTimeoutPresentCase_ = 0; + netWriteTimeoutPresent_ = null; + onChanged(); + return this; + } + + + private java.lang.Object username_ = ""; + /** + * string username = 1; + */ + public java.lang.String getUsername() { + java.lang.Object ref = username_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + username_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string username = 1; + */ + public com.google.protobuf.ByteString + getUsernameBytes() { + java.lang.Object ref = username_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + username_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string username = 1; + */ + public Builder setUsername( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + username_ = value; + onChanged(); + return this; + } + /** + * string username = 1; + */ + public Builder clearUsername() { + + username_ = getDefaultInstance().getUsername(); + onChanged(); + return this; + } + /** + * string username = 1; + */ + public Builder setUsernameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + username_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString password_ = com.google.protobuf.ByteString.EMPTY; + /** + *
    +       * hashed password with seeds from Handshake message
    +       * 
    + * + * bytes password = 2; + */ + public com.google.protobuf.ByteString getPassword() { + return password_; + } + /** + *
    +       * hashed password with seeds from Handshake message
    +       * 
    + * + * bytes password = 2; + */ + public Builder setPassword(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + password_ = value; + onChanged(); + return this; + } + /** + *
    +       * hashed password with seeds from Handshake message
    +       * 
    + * + * bytes password = 2; + */ + public Builder clearPassword() { + + password_ = getDefaultInstance().getPassword(); + onChanged(); + return this; + } + + /** + *
    +       * in seconds
    +       * 
    + * + * int32 net_read_timeout = 3; + */ + public int getNetReadTimeout() { + if (netReadTimeoutPresentCase_ == 3) { + return (java.lang.Integer) netReadTimeoutPresent_; + } + return 0; + } + /** + *
    +       * in seconds
    +       * 
    + * + * int32 net_read_timeout = 3; + */ + public Builder setNetReadTimeout(int value) { + netReadTimeoutPresentCase_ = 3; + netReadTimeoutPresent_ = value; + onChanged(); + return this; + } + /** + *
    +       * in seconds
    +       * 
    + * + * int32 net_read_timeout = 3; + */ + public Builder clearNetReadTimeout() { + if (netReadTimeoutPresentCase_ == 3) { + netReadTimeoutPresentCase_ = 0; + netReadTimeoutPresent_ = null; + onChanged(); + } + return this; + } + + /** + *
    +       * in seconds
    +       * 
    + * + * int32 net_write_timeout = 4; + */ + public int getNetWriteTimeout() { + if (netWriteTimeoutPresentCase_ == 4) { + return (java.lang.Integer) netWriteTimeoutPresent_; + } + return 0; + } + /** + *
    +       * in seconds
    +       * 
    + * + * int32 net_write_timeout = 4; + */ + public Builder setNetWriteTimeout(int value) { + netWriteTimeoutPresentCase_ = 4; + netWriteTimeoutPresent_ = value; + onChanged(); + return this; + } + /** + *
    +       * in seconds
    +       * 
    + * + * int32 net_write_timeout = 4; + */ + public Builder clearNetWriteTimeout() { + if (netWriteTimeoutPresentCase_ == 4) { + netWriteTimeoutPresentCase_ = 0; + netWriteTimeoutPresent_ = null; + onChanged(); + } + return this; + } + + private java.lang.Object destination_ = ""; + /** + * string destination = 5; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string destination = 5; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string destination = 5; + */ + public Builder setDestination( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + destination_ = value; + onChanged(); + return this; + } + /** + * string destination = 5; + */ + public Builder clearDestination() { + + destination_ = getDefaultInstance().getDestination(); + onChanged(); + return this; + } + /** + * string destination = 5; + */ + public Builder setDestinationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + destination_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + /** + * string client_id = 6; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string client_id = 6; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string client_id = 6; + */ + public Builder setClientId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientId_ = value; + onChanged(); + return this; + } + /** + * string client_id = 6; + */ + public Builder clearClientId() { + + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + /** + * string client_id = 6; + */ + public Builder setClientIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientId_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * string filter = 7; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string filter = 7; + */ + public com.google.protobuf.ByteString + getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string filter = 7; + */ + public Builder setFilter( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * string filter = 7; + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * string filter = 7; + */ + public Builder setFilterBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + private long startTimestamp_ ; + /** + * int64 start_timestamp = 8; + */ + public long getStartTimestamp() { + return startTimestamp_; + } + /** + * int64 start_timestamp = 8; + */ + public Builder setStartTimestamp(long value) { + + startTimestamp_ = value; + onChanged(); + return this; + } + /** + * int64 start_timestamp = 8; + */ + public Builder clearStartTimestamp() { + + startTimestamp_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.ClientAuth) } - public interface AckOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Ack) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int32 error_code = 1 [default = 0]; - */ - boolean hasErrorCode(); - - /** - * optional int32 error_code = 1 [default = 0]; - */ - int getErrorCode(); - - /** - * optional string error_message = 2; - * - *
    -         * if something like compression is not supported, erorr_message will tell about it.
    -         * 
    - */ - boolean hasErrorMessage(); - - /** - * optional string error_message = 2; - * - *
    -         * if something like compression is not supported, erorr_message will tell about it.
    -         * 
    - */ - java.lang.String getErrorMessage(); - - /** - * optional string error_message = 2; - * - *
    -         * if something like compression is not supported, erorr_message will tell about it.
    -         * 
    - */ - com.google.protobuf.ByteString getErrorMessageBytes(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.ClientAuth) + private static final com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClientAuth parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClientAuth(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAuth getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface AckOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Ack) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 error_code = 1; + */ + int getErrorCode(); + + /** + *
    +     * if something like compression is not supported, erorr_message will tell about it.
    +     * 
    + * + * string error_message = 2; + */ + java.lang.String getErrorMessage(); + /** + *
    +     * if something like compression is not supported, erorr_message will tell about it.
    +     * 
    + * + * string error_message = 2; + */ + com.google.protobuf.ByteString + getErrorMessageBytes(); + + public com.alibaba.otter.canal.protocol.CanalPacket.Ack.ErrorCodePresentCase getErrorCodePresentCase(); + } + /** + * Protobuf type {@code com.alibaba.otter.canal.protocol.Ack} + */ + public static final class Ack extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Ack) + AckOrBuilder { + private static final long serialVersionUID = 0L; + // Use Ack.newBuilder() to construct. + private Ack(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Ack() { + errorMessage_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Ack( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + errorCodePresentCase_ = 1; + errorCodePresent_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + errorMessage_ = s; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Ack.class, com.alibaba.otter.canal.protocol.CanalPacket.Ack.Builder.class); + } + + private int errorCodePresentCase_ = 0; + private java.lang.Object errorCodePresent_; + public enum ErrorCodePresentCase + implements com.google.protobuf.Internal.EnumLite { + ERROR_CODE(1), + ERRORCODEPRESENT_NOT_SET(0); + private final int value; + private ErrorCodePresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ErrorCodePresentCase valueOf(int value) { + return forNumber(value); + } + + public static ErrorCodePresentCase forNumber(int value) { + switch (value) { + case 1: return ERROR_CODE; + case 0: return ERRORCODEPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ErrorCodePresentCase + getErrorCodePresentCase() { + return ErrorCodePresentCase.forNumber( + errorCodePresentCase_); + } + + public static final int ERROR_CODE_FIELD_NUMBER = 1; + /** + * int32 error_code = 1; + */ + public int getErrorCode() { + if (errorCodePresentCase_ == 1) { + return (java.lang.Integer) errorCodePresent_; + } + return 0; + } + + public static final int ERROR_MESSAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object errorMessage_; + /** + *
    +     * if something like compression is not supported, erorr_message will tell about it.
    +     * 
    + * + * string error_message = 2; + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } + } + /** + *
    +     * if something like compression is not supported, erorr_message will tell about it.
    +     * 
    + * + * string error_message = 2; + */ + public com.google.protobuf.ByteString + getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (errorCodePresentCase_ == 1) { + output.writeInt32( + 1, (int)((java.lang.Integer) errorCodePresent_)); + } + if (!getErrorMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, errorMessage_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (errorCodePresentCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 1, (int)((java.lang.Integer) errorCodePresent_)); + } + if (!getErrorMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, errorMessage_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Ack)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Ack other = (com.alibaba.otter.canal.protocol.CanalPacket.Ack) obj; + + boolean result = true; + result = result && getErrorMessage() + .equals(other.getErrorMessage()); + result = result && getErrorCodePresentCase().equals( + other.getErrorCodePresentCase()); + if (!result) return false; + switch (errorCodePresentCase_) { + case 1: + result = result && (getErrorCode() + == other.getErrorCode()); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ERROR_MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getErrorMessage().hashCode(); + switch (errorCodePresentCase_) { + case 1: + hash = (37 * hash) + ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getErrorCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Ack prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code com.alibaba.otter.canal.protocol.Ack} */ - public static final class Ack extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Ack) - AckOrBuilder { - - // Use Ack.newBuilder() to construct. - private Ack(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Ack(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Ack defaultInstance; - - public static Ack getDefaultInstance() { - return defaultInstance; - } - - public Ack getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Ack(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - errorCode_ = input.readInt32(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - errorMessage_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Ack.class, - com.alibaba.otter.canal.protocol.CanalPacket.Ack.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Ack parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Ack(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ERROR_CODE_FIELD_NUMBER = 1; - private int errorCode_; - - /** - * optional int32 error_code = 1 [default = 0]; - */ - public boolean hasErrorCode() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int32 error_code = 1 [default = 0]; - */ - public int getErrorCode() { - return errorCode_; - } - - public static final int ERROR_MESSAGE_FIELD_NUMBER = 2; - private java.lang.Object errorMessage_; - - /** - * optional string error_message = 2; - * - *
    -         * if something like compression is not supported, erorr_message will tell about it.
    -         * 
    - */ - public boolean hasErrorMessage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string error_message = 2; - * - *
    -         * if something like compression is not supported, erorr_message will tell about it.
    -         * 
    - */ - public java.lang.String getErrorMessage() { - java.lang.Object ref = errorMessage_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - errorMessage_ = s; - } - return s; - } - } - - /** - * optional string error_message = 2; - * - *
    -         * if something like compression is not supported, erorr_message will tell about it.
    -         * 
    - */ - public com.google.protobuf.ByteString getErrorMessageBytes() { - java.lang.Object ref = errorMessage_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - errorMessage_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - errorCode_ = 0; - errorMessage_ = ""; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, errorCode_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getErrorMessageBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, errorCode_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getErrorMessageBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Ack parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Ack prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Ack} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Ack) com.alibaba.otter.canal.protocol.CanalPacket.AckOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Ack.class, com.alibaba.otter.canal.protocol.CanalPacket.Ack.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Ack.class, - com.alibaba.otter.canal.protocol.CanalPacket.Ack.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Ack.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Ack.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - errorCode_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - errorMessage_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Ack getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Ack.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Ack build() { - com.alibaba.otter.canal.protocol.CanalPacket.Ack result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Ack buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Ack result = new com.alibaba.otter.canal.protocol.CanalPacket.Ack(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.errorCode_ = errorCode_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.errorMessage_ = errorMessage_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Ack) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Ack) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Ack other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Ack.getDefaultInstance()) return this; - if (other.hasErrorCode()) { - setErrorCode(other.getErrorCode()); - } - if (other.hasErrorMessage()) { - bitField0_ |= 0x00000002; - errorMessage_ = other.errorMessage_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Ack parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Ack) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private int errorCode_; - - /** - * optional int32 error_code = 1 [default = 0]; - */ - public boolean hasErrorCode() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int32 error_code = 1 [default = 0]; - */ - public int getErrorCode() { - return errorCode_; - } - - /** - * optional int32 error_code = 1 [default = 0]; - */ - public Builder setErrorCode(int value) { - bitField0_ |= 0x00000001; - errorCode_ = value; - onChanged(); - return this; - } - - /** - * optional int32 error_code = 1 [default = 0]; - */ - public Builder clearErrorCode() { - bitField0_ = (bitField0_ & ~0x00000001); - errorCode_ = 0; - onChanged(); - return this; - } - - private java.lang.Object errorMessage_ = ""; - - /** - * optional string error_message = 2; - * - *
    -             * if something like compression is not supported, erorr_message will tell about it.
    -             * 
    - */ - public boolean hasErrorMessage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string error_message = 2; - * - *
    -             * if something like compression is not supported, erorr_message will tell about it.
    -             * 
    - */ - public java.lang.String getErrorMessage() { - java.lang.Object ref = errorMessage_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - errorMessage_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string error_message = 2; - * - *
    -             * if something like compression is not supported, erorr_message will tell about it.
    -             * 
    - */ - public com.google.protobuf.ByteString getErrorMessageBytes() { - java.lang.Object ref = errorMessage_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - errorMessage_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string error_message = 2; - * - *
    -             * if something like compression is not supported, erorr_message will tell about it.
    -             * 
    - */ - public Builder setErrorMessage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - errorMessage_ = value; - onChanged(); - return this; - } - - /** - * optional string error_message = 2; - * - *
    -             * if something like compression is not supported, erorr_message will tell about it.
    -             * 
    - */ - public Builder clearErrorMessage() { - bitField0_ = (bitField0_ & ~0x00000002); - errorMessage_ = getDefaultInstance().getErrorMessage(); - onChanged(); - return this; - } - - /** - * optional string error_message = 2; - * - *
    -             * if something like compression is not supported, erorr_message will tell about it.
    -             * 
    - */ - public Builder setErrorMessageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - errorMessage_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Ack) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + errorMessage_ = ""; - static { - defaultInstance = new Ack(true); - defaultInstance.initFields(); + errorCodePresentCase_ = 0; + errorCodePresent_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Ack getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Ack.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Ack build() { + com.alibaba.otter.canal.protocol.CanalPacket.Ack result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Ack) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Ack buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Ack result = new com.alibaba.otter.canal.protocol.CanalPacket.Ack(this); + if (errorCodePresentCase_ == 1) { + result.errorCodePresent_ = errorCodePresent_; + } + result.errorMessage_ = errorMessage_; + result.errorCodePresentCase_ = errorCodePresentCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Ack) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Ack)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Ack other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Ack.getDefaultInstance()) return this; + if (!other.getErrorMessage().isEmpty()) { + errorMessage_ = other.errorMessage_; + onChanged(); + } + switch (other.getErrorCodePresentCase()) { + case ERROR_CODE: { + setErrorCode(other.getErrorCode()); + break; + } + case ERRORCODEPRESENT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Ack parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Ack) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int errorCodePresentCase_ = 0; + private java.lang.Object errorCodePresent_; + public ErrorCodePresentCase + getErrorCodePresentCase() { + return ErrorCodePresentCase.forNumber( + errorCodePresentCase_); + } + + public Builder clearErrorCodePresent() { + errorCodePresentCase_ = 0; + errorCodePresent_ = null; + onChanged(); + return this; + } + + + /** + * int32 error_code = 1; + */ + public int getErrorCode() { + if (errorCodePresentCase_ == 1) { + return (java.lang.Integer) errorCodePresent_; + } + return 0; + } + /** + * int32 error_code = 1; + */ + public Builder setErrorCode(int value) { + errorCodePresentCase_ = 1; + errorCodePresent_ = value; + onChanged(); + return this; + } + /** + * int32 error_code = 1; + */ + public Builder clearErrorCode() { + if (errorCodePresentCase_ == 1) { + errorCodePresentCase_ = 0; + errorCodePresent_ = null; + onChanged(); + } + return this; + } + + private java.lang.Object errorMessage_ = ""; + /** + *
    +       * if something like compression is not supported, erorr_message will tell about it.
    +       * 
    + * + * string error_message = 2; + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
    +       * if something like compression is not supported, erorr_message will tell about it.
    +       * 
    + * + * string error_message = 2; + */ + public com.google.protobuf.ByteString + getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
    +       * if something like compression is not supported, erorr_message will tell about it.
    +       * 
    + * + * string error_message = 2; + */ + public Builder setErrorMessage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + errorMessage_ = value; + onChanged(); + return this; + } + /** + *
    +       * if something like compression is not supported, erorr_message will tell about it.
    +       * 
    + * + * string error_message = 2; + */ + public Builder clearErrorMessage() { + + errorMessage_ = getDefaultInstance().getErrorMessage(); + onChanged(); + return this; + } + /** + *
    +       * if something like compression is not supported, erorr_message will tell about it.
    +       * 
    + * + * string error_message = 2; + */ + public Builder setErrorMessageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + errorMessage_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Ack) } - public interface ClientAckOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.ClientAck) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string destination = 1; - */ - boolean hasDestination(); - - /** - * optional string destination = 1; - */ - java.lang.String getDestination(); - - /** - * optional string destination = 1; - */ - com.google.protobuf.ByteString getDestinationBytes(); - - /** - * optional string client_id = 2; - */ - boolean hasClientId(); - - /** - * optional string client_id = 2; - */ - java.lang.String getClientId(); - - /** - * optional string client_id = 2; - */ - com.google.protobuf.ByteString getClientIdBytes(); - - /** - * optional int64 batch_id = 3; - */ - boolean hasBatchId(); - - /** - * optional int64 batch_id = 3; - */ - long getBatchId(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Ack) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Ack DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Ack(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Ack getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Ack parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Ack(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Ack getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ClientAckOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.ClientAck) + com.google.protobuf.MessageOrBuilder { + + /** + * string destination = 1; + */ + java.lang.String getDestination(); + /** + * string destination = 1; + */ + com.google.protobuf.ByteString + getDestinationBytes(); + + /** + * string client_id = 2; + */ + java.lang.String getClientId(); + /** + * string client_id = 2; + */ + com.google.protobuf.ByteString + getClientIdBytes(); + + /** + * int64 batch_id = 3; + */ + long getBatchId(); + } + /** + * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAck} + */ + public static final class ClientAck extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.ClientAck) + ClientAckOrBuilder { + private static final long serialVersionUID = 0L; + // Use ClientAck.newBuilder() to construct. + private ClientAck(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClientAck() { + destination_ = ""; + clientId_ = ""; + batchId_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClientAck( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + destination_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + clientId_ = s; + break; + } + case 24: { + + batchId_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.class, com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.Builder.class); + } + + public static final int DESTINATION_FIELD_NUMBER = 1; + private volatile java.lang.Object destination_; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object clientId_; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCH_ID_FIELD_NUMBER = 3; + private long batchId_; + /** + * int64 batch_id = 3; + */ + public long getBatchId() { + return batchId_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, clientId_); + } + if (batchId_ != 0L) { + output.writeInt64(3, batchId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, clientId_); + } + if (batchId_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, batchId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientAck)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.ClientAck other = (com.alibaba.otter.canal.protocol.CanalPacket.ClientAck) obj; + + boolean result = true; + result = result && getDestination() + .equals(other.getDestination()); + result = result && getClientId() + .equals(other.getClientId()); + result = result && (getBatchId() + == other.getBatchId()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + BATCH_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getBatchId()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.ClientAck prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAck} */ - public static final class ClientAck extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.ClientAck) - ClientAckOrBuilder { - - // Use ClientAck.newBuilder() to construct. - private ClientAck(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private ClientAck(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final ClientAck defaultInstance; - - public static ClientAck getDefaultInstance() { - return defaultInstance; - } - - public ClientAck getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ClientAck(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - destination_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - clientId_ = bs; - break; - } - case 24: { - bitField0_ |= 0x00000004; - batchId_ = input.readInt64(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.class, - com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public ClientAck parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ClientAck(input, - extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int DESTINATION_FIELD_NUMBER = 1; - private java.lang.Object destination_; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CLIENT_ID_FIELD_NUMBER = 2; - private java.lang.Object clientId_; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BATCH_ID_FIELD_NUMBER = 3; - private long batchId_; - - /** - * optional int64 batch_id = 3; - */ - public boolean hasBatchId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int64 batch_id = 3; - */ - public long getBatchId() { - return batchId_; - } - - private void initFields() { - destination_ = ""; - clientId_ = ""; - batchId_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, batchId_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, batchId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.ClientAck prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientAck} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.ClientAck) com.alibaba.otter.canal.protocol.CanalPacket.ClientAckOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.class, com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.class, - com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - destination_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - clientId_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - batchId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck build() { - com.alibaba.otter.canal.protocol.CanalPacket.ClientAck result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.ClientAck result = new com.alibaba.otter.canal.protocol.CanalPacket.ClientAck(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.destination_ = destination_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clientId_ = clientId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.batchId_ = batchId_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientAck) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.ClientAck) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.ClientAck other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.getDefaultInstance()) return this; - if (other.hasDestination()) { - bitField0_ |= 0x00000001; - destination_ = other.destination_; - onChanged(); - } - if (other.hasClientId()) { - bitField0_ |= 0x00000002; - clientId_ = other.clientId_; - onChanged(); - } - if (other.hasBatchId()) { - setBatchId(other.getBatchId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.ClientAck) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object destination_ = ""; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string destination = 1; - */ - public Builder setDestination(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder clearDestination() { - bitField0_ = (bitField0_ & ~0x00000001); - destination_ = getDefaultInstance().getDestination(); - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder setDestinationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - private java.lang.Object clientId_ = ""; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string client_id = 2; - */ - public Builder setClientId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder clearClientId() { - bitField0_ = (bitField0_ & ~0x00000002); - clientId_ = getDefaultInstance().getClientId(); - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder setClientIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - private long batchId_; - - /** - * optional int64 batch_id = 3; - */ - public boolean hasBatchId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int64 batch_id = 3; - */ - public long getBatchId() { - return batchId_; - } - - /** - * optional int64 batch_id = 3; - */ - public Builder setBatchId(long value) { - bitField0_ |= 0x00000004; - batchId_ = value; - onChanged(); - return this; - } - - /** - * optional int64 batch_id = 3; - */ - public Builder clearBatchId() { - bitField0_ = (bitField0_ & ~0x00000004); - batchId_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.ClientAck) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + destination_ = ""; - static { - defaultInstance = new ClientAck(true); - defaultInstance.initFields(); + clientId_ = ""; + + batchId_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck build() { + com.alibaba.otter.canal.protocol.CanalPacket.ClientAck result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.ClientAck) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.ClientAck result = new com.alibaba.otter.canal.protocol.CanalPacket.ClientAck(this); + result.destination_ = destination_; + result.clientId_ = clientId_; + result.batchId_ = batchId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientAck) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.ClientAck)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.ClientAck other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.ClientAck.getDefaultInstance()) return this; + if (!other.getDestination().isEmpty()) { + destination_ = other.destination_; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + onChanged(); + } + if (other.getBatchId() != 0L) { + setBatchId(other.getBatchId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.ClientAck parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.ClientAck) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object destination_ = ""; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string destination = 1; + */ + public Builder setDestination( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + destination_ = value; + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder clearDestination() { + + destination_ = getDefaultInstance().getDestination(); + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder setDestinationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + destination_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string client_id = 2; + */ + public Builder setClientId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientId_ = value; + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder clearClientId() { + + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder setClientIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientId_ = value; + onChanged(); + return this; + } + + private long batchId_ ; + /** + * int64 batch_id = 3; + */ + public long getBatchId() { + return batchId_; + } + /** + * int64 batch_id = 3; + */ + public Builder setBatchId(long value) { + + batchId_ = value; + onChanged(); + return this; + } + /** + * int64 batch_id = 3; + */ + public Builder clearBatchId() { + + batchId_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.ClientAck) } - public interface SubOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Sub) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string destination = 1; - */ - boolean hasDestination(); - - /** - * optional string destination = 1; - */ - java.lang.String getDestination(); - - /** - * optional string destination = 1; - */ - com.google.protobuf.ByteString getDestinationBytes(); - - /** - * optional string client_id = 2; - */ - boolean hasClientId(); - - /** - * optional string client_id = 2; - */ - java.lang.String getClientId(); - - /** - * optional string client_id = 2; - */ - com.google.protobuf.ByteString getClientIdBytes(); - - /** - * optional string filter = 7; - */ - boolean hasFilter(); - - /** - * optional string filter = 7; - */ - java.lang.String getFilter(); - - /** - * optional string filter = 7; - */ - com.google.protobuf.ByteString getFilterBytes(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.ClientAck) + private static final com.alibaba.otter.canal.protocol.CanalPacket.ClientAck DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.ClientAck(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientAck getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClientAck parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClientAck(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientAck getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface SubOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Sub) + com.google.protobuf.MessageOrBuilder { + + /** + * string destination = 1; + */ + java.lang.String getDestination(); + /** + * string destination = 1; + */ + com.google.protobuf.ByteString + getDestinationBytes(); + + /** + * string client_id = 2; + */ + java.lang.String getClientId(); + /** + * string client_id = 2; + */ + com.google.protobuf.ByteString + getClientIdBytes(); + + /** + * string filter = 7; + */ + java.lang.String getFilter(); + /** + * string filter = 7; + */ + com.google.protobuf.ByteString + getFilterBytes(); + } + /** + *
    +   * subscription
    +   * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Sub} + */ + public static final class Sub extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Sub) + SubOrBuilder { + private static final long serialVersionUID = 0L; + // Use Sub.newBuilder() to construct. + private Sub(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Sub() { + destination_ = ""; + clientId_ = ""; + filter_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Sub( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + destination_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + clientId_ = s; + break; + } + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Sub.class, com.alibaba.otter.canal.protocol.CanalPacket.Sub.Builder.class); + } + + public static final int DESTINATION_FIELD_NUMBER = 1; + private volatile java.lang.Object destination_; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object clientId_; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 7; + private volatile java.lang.Object filter_; + /** + * string filter = 7; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * string filter = 7; + */ + public com.google.protobuf.ByteString + getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, clientId_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, filter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, clientId_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, filter_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Sub)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Sub other = (com.alibaba.otter.canal.protocol.CanalPacket.Sub) obj; + + boolean result = true; + result = result && getDestination() + .equals(other.getDestination()); + result = result && getClientId() + .equals(other.getClientId()); + result = result && getFilter() + .equals(other.getFilter()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Sub prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Sub} - * *
          * subscription
          * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Sub} */ - public static final class Sub extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Sub) - SubOrBuilder { - - // Use Sub.newBuilder() to construct. - private Sub(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Sub(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Sub defaultInstance; - - public static Sub getDefaultInstance() { - return defaultInstance; - } - - public Sub getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Sub(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - destination_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - clientId_ = bs; - break; - } - case 58: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000004; - filter_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Sub.class, - com.alibaba.otter.canal.protocol.CanalPacket.Sub.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Sub parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Sub(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int DESTINATION_FIELD_NUMBER = 1; - private java.lang.Object destination_; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CLIENT_ID_FIELD_NUMBER = 2; - private java.lang.Object clientId_; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int FILTER_FIELD_NUMBER = 7; - private java.lang.Object filter_; - - /** - * optional string filter = 7; - */ - public boolean hasFilter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional string filter = 7; - */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - filter_ = s; - } - return s; - } - } - - /** - * optional string filter = 7; - */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - destination_ = ""; - clientId_ = ""; - filter_ = ""; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(7, getFilterBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getFilterBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Sub parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Sub prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Sub} - * - *
    -         * subscription
    -         * 
    - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Sub) com.alibaba.otter.canal.protocol.CanalPacket.SubOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Sub.class, com.alibaba.otter.canal.protocol.CanalPacket.Sub.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Sub.class, - com.alibaba.otter.canal.protocol.CanalPacket.Sub.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Sub.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Sub.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - destination_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - clientId_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - filter_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Sub getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Sub.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Sub build() { - com.alibaba.otter.canal.protocol.CanalPacket.Sub result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Sub buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Sub result = new com.alibaba.otter.canal.protocol.CanalPacket.Sub(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.destination_ = destination_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clientId_ = clientId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.filter_ = filter_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Sub) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Sub) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Sub other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Sub.getDefaultInstance()) return this; - if (other.hasDestination()) { - bitField0_ |= 0x00000001; - destination_ = other.destination_; - onChanged(); - } - if (other.hasClientId()) { - bitField0_ |= 0x00000002; - clientId_ = other.clientId_; - onChanged(); - } - if (other.hasFilter()) { - bitField0_ |= 0x00000004; - filter_ = other.filter_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Sub parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Sub) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object destination_ = ""; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string destination = 1; - */ - public Builder setDestination(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder clearDestination() { - bitField0_ = (bitField0_ & ~0x00000001); - destination_ = getDefaultInstance().getDestination(); - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder setDestinationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - private java.lang.Object clientId_ = ""; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string client_id = 2; - */ - public Builder setClientId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder clearClientId() { - bitField0_ = (bitField0_ & ~0x00000002); - clientId_ = getDefaultInstance().getClientId(); - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder setClientIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - private java.lang.Object filter_ = ""; - - /** - * optional string filter = 7; - */ - public boolean hasFilter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional string filter = 7; - */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - filter_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string filter = 7; - */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string filter = 7; - */ - public Builder setFilter(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - filter_ = value; - onChanged(); - return this; - } - - /** - * optional string filter = 7; - */ - public Builder clearFilter() { - bitField0_ = (bitField0_ & ~0x00000004); - filter_ = getDefaultInstance().getFilter(); - onChanged(); - return this; - } - - /** - * optional string filter = 7; - */ - public Builder setFilterBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - filter_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Sub) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + destination_ = ""; - static { - defaultInstance = new Sub(true); - defaultInstance.initFields(); + clientId_ = ""; + + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Sub getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Sub.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Sub build() { + com.alibaba.otter.canal.protocol.CanalPacket.Sub result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Sub) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Sub buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Sub result = new com.alibaba.otter.canal.protocol.CanalPacket.Sub(this); + result.destination_ = destination_; + result.clientId_ = clientId_; + result.filter_ = filter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Sub) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Sub)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Sub other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Sub.getDefaultInstance()) return this; + if (!other.getDestination().isEmpty()) { + destination_ = other.destination_; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Sub parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Sub) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object destination_ = ""; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string destination = 1; + */ + public Builder setDestination( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + destination_ = value; + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder clearDestination() { + + destination_ = getDefaultInstance().getDestination(); + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder setDestinationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + destination_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string client_id = 2; + */ + public Builder setClientId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientId_ = value; + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder clearClientId() { + + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder setClientIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientId_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * string filter = 7; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string filter = 7; + */ + public com.google.protobuf.ByteString + getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string filter = 7; + */ + public Builder setFilter( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * string filter = 7; + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * string filter = 7; + */ + public Builder setFilterBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Sub) } - public interface UnsubOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Unsub) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string destination = 1; - */ - boolean hasDestination(); - - /** - * optional string destination = 1; - */ - java.lang.String getDestination(); - - /** - * optional string destination = 1; - */ - com.google.protobuf.ByteString getDestinationBytes(); - - /** - * optional string client_id = 2; - */ - boolean hasClientId(); - - /** - * optional string client_id = 2; - */ - java.lang.String getClientId(); - - /** - * optional string client_id = 2; - */ - com.google.protobuf.ByteString getClientIdBytes(); - - /** - * optional string filter = 7; - */ - boolean hasFilter(); - - /** - * optional string filter = 7; - */ - java.lang.String getFilter(); - - /** - * optional string filter = 7; - */ - com.google.protobuf.ByteString getFilterBytes(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Sub) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Sub DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Sub(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Sub getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Sub parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Sub(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Sub getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface UnsubOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Unsub) + com.google.protobuf.MessageOrBuilder { + + /** + * string destination = 1; + */ + java.lang.String getDestination(); + /** + * string destination = 1; + */ + com.google.protobuf.ByteString + getDestinationBytes(); + + /** + * string client_id = 2; + */ + java.lang.String getClientId(); + /** + * string client_id = 2; + */ + com.google.protobuf.ByteString + getClientIdBytes(); + + /** + * string filter = 7; + */ + java.lang.String getFilter(); + /** + * string filter = 7; + */ + com.google.protobuf.ByteString + getFilterBytes(); + } + /** + *
    +   * Unsubscription
    +   * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Unsub} + */ + public static final class Unsub extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Unsub) + UnsubOrBuilder { + private static final long serialVersionUID = 0L; + // Use Unsub.newBuilder() to construct. + private Unsub(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Unsub() { + destination_ = ""; + clientId_ = ""; + filter_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Unsub( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + destination_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + clientId_ = s; + break; + } + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Unsub.class, com.alibaba.otter.canal.protocol.CanalPacket.Unsub.Builder.class); + } + + public static final int DESTINATION_FIELD_NUMBER = 1; + private volatile java.lang.Object destination_; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object clientId_; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 7; + private volatile java.lang.Object filter_; + /** + * string filter = 7; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * string filter = 7; + */ + public com.google.protobuf.ByteString + getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, clientId_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, filter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, clientId_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, filter_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Unsub)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Unsub other = (com.alibaba.otter.canal.protocol.CanalPacket.Unsub) obj; + + boolean result = true; + result = result && getDestination() + .equals(other.getDestination()); + result = result && getClientId() + .equals(other.getClientId()); + result = result && getFilter() + .equals(other.getFilter()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Unsub prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Unsub} - * *
          * Unsubscription
          * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Unsub} */ - public static final class Unsub extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Unsub) - UnsubOrBuilder { - - // Use Unsub.newBuilder() to construct. - private Unsub(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Unsub(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Unsub defaultInstance; - - public static Unsub getDefaultInstance() { - return defaultInstance; - } - - public Unsub getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Unsub(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - destination_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - clientId_ = bs; - break; - } - case 58: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000004; - filter_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Unsub.class, - com.alibaba.otter.canal.protocol.CanalPacket.Unsub.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Unsub parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Unsub(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int DESTINATION_FIELD_NUMBER = 1; - private java.lang.Object destination_; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CLIENT_ID_FIELD_NUMBER = 2; - private java.lang.Object clientId_; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int FILTER_FIELD_NUMBER = 7; - private java.lang.Object filter_; - - /** - * optional string filter = 7; - */ - public boolean hasFilter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional string filter = 7; - */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - filter_ = s; - } - return s; - } - } - - /** - * optional string filter = 7; - */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - destination_ = ""; - clientId_ = ""; - filter_ = ""; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(7, getFilterBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getFilterBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Unsub prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Unsub} - * - *
    -         * Unsubscription
    -         * 
    - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Unsub) com.alibaba.otter.canal.protocol.CanalPacket.UnsubOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Unsub.class, com.alibaba.otter.canal.protocol.CanalPacket.Unsub.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Unsub.class, - com.alibaba.otter.canal.protocol.CanalPacket.Unsub.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Unsub.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Unsub.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - destination_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - clientId_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - filter_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Unsub getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Unsub.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Unsub build() { - com.alibaba.otter.canal.protocol.CanalPacket.Unsub result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Unsub buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Unsub result = new com.alibaba.otter.canal.protocol.CanalPacket.Unsub(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.destination_ = destination_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clientId_ = clientId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.filter_ = filter_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Unsub) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Unsub) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Unsub other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Unsub.getDefaultInstance()) return this; - if (other.hasDestination()) { - bitField0_ |= 0x00000001; - destination_ = other.destination_; - onChanged(); - } - if (other.hasClientId()) { - bitField0_ |= 0x00000002; - clientId_ = other.clientId_; - onChanged(); - } - if (other.hasFilter()) { - bitField0_ |= 0x00000004; - filter_ = other.filter_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Unsub parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Unsub) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object destination_ = ""; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string destination = 1; - */ - public Builder setDestination(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder clearDestination() { - bitField0_ = (bitField0_ & ~0x00000001); - destination_ = getDefaultInstance().getDestination(); - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder setDestinationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - private java.lang.Object clientId_ = ""; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string client_id = 2; - */ - public Builder setClientId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder clearClientId() { - bitField0_ = (bitField0_ & ~0x00000002); - clientId_ = getDefaultInstance().getClientId(); - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder setClientIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - private java.lang.Object filter_ = ""; - - /** - * optional string filter = 7; - */ - public boolean hasFilter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional string filter = 7; - */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - filter_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string filter = 7; - */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string filter = 7; - */ - public Builder setFilter(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - filter_ = value; - onChanged(); - return this; - } - - /** - * optional string filter = 7; - */ - public Builder clearFilter() { - bitField0_ = (bitField0_ & ~0x00000004); - filter_ = getDefaultInstance().getFilter(); - onChanged(); - return this; - } - - /** - * optional string filter = 7; - */ - public Builder setFilterBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - filter_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Unsub) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + destination_ = ""; - static { - defaultInstance = new Unsub(true); - defaultInstance.initFields(); + clientId_ = ""; + + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Unsub getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Unsub.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Unsub build() { + com.alibaba.otter.canal.protocol.CanalPacket.Unsub result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Unsub) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Unsub buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Unsub result = new com.alibaba.otter.canal.protocol.CanalPacket.Unsub(this); + result.destination_ = destination_; + result.clientId_ = clientId_; + result.filter_ = filter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Unsub) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Unsub)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Unsub other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Unsub.getDefaultInstance()) return this; + if (!other.getDestination().isEmpty()) { + destination_ = other.destination_; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Unsub parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Unsub) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object destination_ = ""; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string destination = 1; + */ + public Builder setDestination( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + destination_ = value; + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder clearDestination() { + + destination_ = getDefaultInstance().getDestination(); + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder setDestinationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + destination_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string client_id = 2; + */ + public Builder setClientId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientId_ = value; + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder clearClientId() { + + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder setClientIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientId_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * string filter = 7; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string filter = 7; + */ + public com.google.protobuf.ByteString + getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string filter = 7; + */ + public Builder setFilter( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * string filter = 7; + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * string filter = 7; + */ + public Builder setFilterBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Unsub) } - public interface GetOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Get) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string destination = 1; - */ - boolean hasDestination(); - - /** - * optional string destination = 1; - */ - java.lang.String getDestination(); - - /** - * optional string destination = 1; - */ - com.google.protobuf.ByteString getDestinationBytes(); - - /** - * optional string client_id = 2; - */ - boolean hasClientId(); - - /** - * optional string client_id = 2; - */ - java.lang.String getClientId(); - - /** - * optional string client_id = 2; - */ - com.google.protobuf.ByteString getClientIdBytes(); - - /** - * optional int32 fetch_size = 3; - */ - boolean hasFetchSize(); - - /** - * optional int32 fetch_size = 3; - */ - int getFetchSize(); - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -         * 默认-1时代表不控制
    -         * 
    - */ - boolean hasTimeout(); - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -         * 默认-1时代表不控制
    -         * 
    - */ - long getTimeout(); - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -         * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -         * 
    - */ - boolean hasUnit(); - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -         * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -         * 
    - */ - int getUnit(); - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -         * 是否自动ack
    -         * 
    - */ - boolean hasAutoAck(); - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -         * 是否自动ack
    -         * 
    - */ - boolean getAutoAck(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Unsub) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Unsub DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Unsub(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Unsub getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Unsub parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Unsub(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Unsub getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface GetOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Get) + com.google.protobuf.MessageOrBuilder { + /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Get} - * - *
    -     * PullRequest
    -     * 
    + * string destination = 1; */ - public static final class Get extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Get) - GetOrBuilder { + java.lang.String getDestination(); + /** + * string destination = 1; + */ + com.google.protobuf.ByteString + getDestinationBytes(); - // Use Get.newBuilder() to construct. - private Get(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } + /** + * string client_id = 2; + */ + java.lang.String getClientId(); + /** + * string client_id = 2; + */ + com.google.protobuf.ByteString + getClientIdBytes(); - private Get(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } + /** + * int32 fetch_size = 3; + */ + int getFetchSize(); - private static final Get defaultInstance; + /** + *
    +     * 默认-1时代表不控制
    +     * 
    + * + * int64 timeout = 4; + */ + long getTimeout(); - public static Get getDefaultInstance() { - return defaultInstance; - } + /** + *
    +     * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    +     * 
    + * + * int32 unit = 5; + */ + int getUnit(); - public Get getDefaultInstanceForType() { - return defaultInstance; - } + /** + *
    +     * 是否自动ack
    +     * 
    + * + * bool auto_ack = 6; + */ + boolean getAutoAck(); - private final com.google.protobuf.UnknownFieldSet unknownFields; + public com.alibaba.otter.canal.protocol.CanalPacket.Get.TimeoutPresentCase getTimeoutPresentCase(); - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } + public com.alibaba.otter.canal.protocol.CanalPacket.Get.UnitPresentCase getUnitPresentCase(); - private Get(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - destination_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - clientId_ = bs; - break; - } - case 24: { - bitField0_ |= 0x00000004; - fetchSize_ = input.readInt32(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - timeout_ = input.readInt64(); - break; - } - case 40: { - bitField0_ |= 0x00000010; - unit_ = input.readInt32(); - break; - } - case 48: { - bitField0_ |= 0x00000020; - autoAck_ = input.readBool(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); + public com.alibaba.otter.canal.protocol.CanalPacket.Get.AutoAckPresentCase getAutoAckPresentCase(); + } + /** + *
    +   *  PullRequest
    +   * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Get} + */ + public static final class Get extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Get) + GetOrBuilder { + private static final long serialVersionUID = 0L; + // Use Get.newBuilder() to construct. + private Get(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Get() { + destination_ = ""; + clientId_ = ""; + fetchSize_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Get( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + destination_ = s; + break; } - } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Get.class, - com.alibaba.otter.canal.protocol.CanalPacket.Get.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Get parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Get(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int DESTINATION_FIELD_NUMBER = 1; - private java.lang.Object destination_; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; + clientId_ = s; + break; } - } + case 24: { - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + fetchSize_ = input.readInt32(); + break; } - } - - public static final int CLIENT_ID_FIELD_NUMBER = 2; - private java.lang.Object clientId_; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; + case 32: { + timeoutPresentCase_ = 4; + timeoutPresent_ = input.readInt64(); + break; } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + case 40: { + unitPresentCase_ = 5; + unitPresent_ = input.readInt32(); + break; } - } - - public static final int FETCH_SIZE_FIELD_NUMBER = 3; - private int fetchSize_; - - /** - * optional int32 fetch_size = 3; - */ - public boolean hasFetchSize() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int32 fetch_size = 3; - */ - public int getFetchSize() { - return fetchSize_; - } - - public static final int TIMEOUT_FIELD_NUMBER = 4; - private long timeout_; - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -         * 默认-1时代表不控制
    -         * 
    - */ - public boolean hasTimeout() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -         * 默认-1时代表不控制
    -         * 
    - */ - public long getTimeout() { - return timeout_; - } - - public static final int UNIT_FIELD_NUMBER = 5; - private int unit_; - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -         * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -         * 
    - */ - public boolean hasUnit() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -         * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -         * 
    - */ - public int getUnit() { - return unit_; - } - - public static final int AUTO_ACK_FIELD_NUMBER = 6; - private boolean autoAck_; - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -         * 是否自动ack
    -         * 
    - */ - public boolean hasAutoAck() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -         * 是否自动ack
    -         * 
    - */ - public boolean getAutoAck() { - return autoAck_; - } - - private void initFields() { - destination_ = ""; - clientId_ = ""; - fetchSize_ = 0; - timeout_ = -1L; - unit_ = 2; - autoAck_ = false; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getDestinationBytes()); + case 48: { + autoAckPresentCase_ = 6; + autoAckPresent_ = input.readBool(); + break; } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getClientIdBytes()); + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt32(3, fetchSize_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt64(4, timeout_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt32(5, unit_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBool(6, autoAck_); - } - getUnknownFields().writeTo(output); + } } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; + } - private int memoizedSerializedSize = -1; + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Get.class, com.alibaba.otter.canal.protocol.CanalPacket.Get.Builder.class); + } - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; + private int timeoutPresentCase_ = 0; + private java.lang.Object timeoutPresent_; + public enum TimeoutPresentCase + implements com.google.protobuf.Internal.EnumLite { + TIMEOUT(4), + TIMEOUTPRESENT_NOT_SET(0); + private final int value; + private TimeoutPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TimeoutPresentCase valueOf(int value) { + return forNumber(value); + } - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, fetchSize_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, timeout_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, unit_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, autoAck_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; + public static TimeoutPresentCase forNumber(int value) { + switch (value) { + case 4: return TIMEOUT; + case 0: return TIMEOUTPRESENT_NOT_SET; + default: return null; } + } + public int getNumber() { + return this.value; + } + }; - private static final long serialVersionUID = 0L; + public TimeoutPresentCase + getTimeoutPresentCase() { + return TimeoutPresentCase.forNumber( + timeoutPresentCase_); + } - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); + private int unitPresentCase_ = 0; + private java.lang.Object unitPresent_; + public enum UnitPresentCase + implements com.google.protobuf.Internal.EnumLite { + UNIT(5), + UNITPRESENT_NOT_SET(0); + private final int value; + private UnitPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static UnitPresentCase valueOf(int value) { + return forNumber(value); + } + + public static UnitPresentCase forNumber(int value) { + switch (value) { + case 5: return UNIT; + case 0: return UNITPRESENT_NOT_SET; + default: return null; } + } + public int getNumber() { + return this.value; + } + }; - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); + public UnitPresentCase + getUnitPresentCase() { + return UnitPresentCase.forNumber( + unitPresentCase_); + } + + private int autoAckPresentCase_ = 0; + private java.lang.Object autoAckPresent_; + public enum AutoAckPresentCase + implements com.google.protobuf.Internal.EnumLite { + AUTO_ACK(6), + AUTOACKPRESENT_NOT_SET(0); + private final int value; + private AutoAckPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AutoAckPresentCase valueOf(int value) { + return forNumber(value); + } + + public static AutoAckPresentCase forNumber(int value) { + switch (value) { + case 6: return AUTO_ACK; + case 0: return AUTOACKPRESENT_NOT_SET; + default: return null; } + } + public int getNumber() { + return this.value; + } + }; - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + public AutoAckPresentCase + getAutoAckPresentCase() { + return AutoAckPresentCase.forNumber( + autoAckPresentCase_); + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static final int DESTINATION_FIELD_NUMBER = 1; + private volatile java.lang.Object destination_; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object clientId_; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } + public static final int FETCH_SIZE_FIELD_NUMBER = 3; + private int fetchSize_; + /** + * int32 fetch_size = 3; + */ + public int getFetchSize() { + return fetchSize_; + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } + public static final int TIMEOUT_FIELD_NUMBER = 4; + /** + *
    +     * 默认-1时代表不控制
    +     * 
    + * + * int64 timeout = 4; + */ + public long getTimeout() { + if (timeoutPresentCase_ == 4) { + return (java.lang.Long) timeoutPresent_; + } + return -1L; + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } + public static final int UNIT_FIELD_NUMBER = 5; + /** + *
    +     * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    +     * 
    + * + * int32 unit = 5; + */ + public int getUnit() { + if (unitPresentCase_ == 5) { + return (java.lang.Integer) unitPresent_; + } + return 2; + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } + public static final int AUTO_ACK_FIELD_NUMBER = 6; + /** + *
    +     * 是否自动ack
    +     * 
    + * + * bool auto_ack = 6; + */ + public boolean getAutoAck() { + if (autoAckPresentCase_ == 6) { + return (java.lang.Boolean) autoAckPresent_; + } + return false; + } - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; - public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } + memoizedIsInitialized = 1; + return true; + } - public static Builder newBuilder() { - return Builder.create(); - } + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, clientId_); + } + if (fetchSize_ != 0) { + output.writeInt32(3, fetchSize_); + } + if (timeoutPresentCase_ == 4) { + output.writeInt64( + 4, (long)((java.lang.Long) timeoutPresent_)); + } + if (unitPresentCase_ == 5) { + output.writeInt32( + 5, (int)((java.lang.Integer) unitPresent_)); + } + if (autoAckPresentCase_ == 6) { + output.writeBool( + 6, (boolean)((java.lang.Boolean) autoAckPresent_)); + } + unknownFields.writeTo(output); + } - public Builder newBuilderForType() { - return newBuilder(); - } + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Get prototype) { - return newBuilder().mergeFrom(prototype); - } + size = 0; + if (!getDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, clientId_); + } + if (fetchSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, fetchSize_); + } + if (timeoutPresentCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size( + 4, (long)((java.lang.Long) timeoutPresent_)); + } + if (unitPresentCase_ == 5) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size( + 5, (int)((java.lang.Integer) unitPresent_)); + } + if (autoAckPresentCase_ == 6) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize( + 6, (boolean)((java.lang.Boolean) autoAckPresent_)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } - public Builder toBuilder() { - return newBuilder(this); - } + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Get)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Get other = (com.alibaba.otter.canal.protocol.CanalPacket.Get) obj; - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } + boolean result = true; + result = result && getDestination() + .equals(other.getDestination()); + result = result && getClientId() + .equals(other.getClientId()); + result = result && (getFetchSize() + == other.getFetchSize()); + result = result && getTimeoutPresentCase().equals( + other.getTimeoutPresentCase()); + if (!result) return false; + switch (timeoutPresentCase_) { + case 4: + result = result && (getTimeout() + == other.getTimeout()); + break; + case 0: + default: + } + result = result && getUnitPresentCase().equals( + other.getUnitPresentCase()); + if (!result) return false; + switch (unitPresentCase_) { + case 5: + result = result && (getUnit() + == other.getUnit()); + break; + case 0: + default: + } + result = result && getAutoAckPresentCase().equals( + other.getAutoAckPresentCase()); + if (!result) return false; + switch (autoAckPresentCase_) { + case 6: + result = result && (getAutoAck() + == other.getAutoAck()); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Get} - * - *
    -         * PullRequest
    -         * 
    - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + FETCH_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getFetchSize(); + switch (timeoutPresentCase_) { + case 4: + hash = (37 * hash) + TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTimeout()); + break; + case 0: + default: + } + switch (unitPresentCase_) { + case 5: + hash = (37 * hash) + UNIT_FIELD_NUMBER; + hash = (53 * hash) + getUnit(); + break; + case 0: + default: + } + switch (autoAckPresentCase_) { + case 6: + hash = (37 * hash) + AUTO_ACK_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getAutoAck()); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Get prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
    +     *  PullRequest
    +     * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Get} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Get) com.alibaba.otter.canal.protocol.CanalPacket.GetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Get.class, com.alibaba.otter.canal.protocol.CanalPacket.Get.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Get.class, - com.alibaba.otter.canal.protocol.CanalPacket.Get.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Get.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Get.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - destination_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - clientId_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - fetchSize_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - timeout_ = -1L; - bitField0_ = (bitField0_ & ~0x00000008); - unit_ = 2; - bitField0_ = (bitField0_ & ~0x00000010); - autoAck_ = false; - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Get getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Get.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Get build() { - com.alibaba.otter.canal.protocol.CanalPacket.Get result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Get buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Get result = new com.alibaba.otter.canal.protocol.CanalPacket.Get(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.destination_ = destination_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clientId_ = clientId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.fetchSize_ = fetchSize_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.timeout_ = timeout_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.unit_ = unit_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.autoAck_ = autoAck_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Get) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Get) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Get other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Get.getDefaultInstance()) return this; - if (other.hasDestination()) { - bitField0_ |= 0x00000001; - destination_ = other.destination_; - onChanged(); - } - if (other.hasClientId()) { - bitField0_ |= 0x00000002; - clientId_ = other.clientId_; - onChanged(); - } - if (other.hasFetchSize()) { - setFetchSize(other.getFetchSize()); - } - if (other.hasTimeout()) { - setTimeout(other.getTimeout()); - } - if (other.hasUnit()) { - setUnit(other.getUnit()); - } - if (other.hasAutoAck()) { - setAutoAck(other.getAutoAck()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Get parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Get) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object destination_ = ""; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string destination = 1; - */ - public Builder setDestination(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder clearDestination() { - bitField0_ = (bitField0_ & ~0x00000001); - destination_ = getDefaultInstance().getDestination(); - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder setDestinationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - private java.lang.Object clientId_ = ""; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string client_id = 2; - */ - public Builder setClientId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder clearClientId() { - bitField0_ = (bitField0_ & ~0x00000002); - clientId_ = getDefaultInstance().getClientId(); - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder setClientIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - private int fetchSize_; - - /** - * optional int32 fetch_size = 3; - */ - public boolean hasFetchSize() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int32 fetch_size = 3; - */ - public int getFetchSize() { - return fetchSize_; - } - - /** - * optional int32 fetch_size = 3; - */ - public Builder setFetchSize(int value) { - bitField0_ |= 0x00000004; - fetchSize_ = value; - onChanged(); - return this; - } - - /** - * optional int32 fetch_size = 3; - */ - public Builder clearFetchSize() { - bitField0_ = (bitField0_ & ~0x00000004); - fetchSize_ = 0; - onChanged(); - return this; - } - - private long timeout_ = -1L; - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -             * 默认-1时代表不控制
    -             * 
    - */ - public boolean hasTimeout() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -             * 默认-1时代表不控制
    -             * 
    - */ - public long getTimeout() { - return timeout_; - } - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -             * 默认-1时代表不控制
    -             * 
    - */ - public Builder setTimeout(long value) { - bitField0_ |= 0x00000008; - timeout_ = value; - onChanged(); - return this; - } - - /** - * optional int64 timeout = 4 [default = -1]; - * - *
    -             * 默认-1时代表不控制
    -             * 
    - */ - public Builder clearTimeout() { - bitField0_ = (bitField0_ & ~0x00000008); - timeout_ = -1L; - onChanged(); - return this; - } - - private int unit_ = 2; - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -             * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -             * 
    - */ - public boolean hasUnit() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -             * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -             * 
    - */ - public int getUnit() { - return unit_; - } - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -             * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -             * 
    - */ - public Builder setUnit(int value) { - bitField0_ |= 0x00000010; - unit_ = value; - onChanged(); - return this; - } - - /** - * optional int32 unit = 5 [default = 2]; - * - *
    -             * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    -             * 
    - */ - public Builder clearUnit() { - bitField0_ = (bitField0_ & ~0x00000010); - unit_ = 2; - onChanged(); - return this; - } - - private boolean autoAck_; - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -             * 是否自动ack
    -             * 
    - */ - public boolean hasAutoAck() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -             * 是否自动ack
    -             * 
    - */ - public boolean getAutoAck() { - return autoAck_; - } - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -             * 是否自动ack
    -             * 
    - */ - public Builder setAutoAck(boolean value) { - bitField0_ |= 0x00000020; - autoAck_ = value; - onChanged(); - return this; - } - - /** - * optional bool auto_ack = 6 [default = false]; - * - *
    -             * 是否自动ack
    -             * 
    - */ - public Builder clearAutoAck() { - bitField0_ = (bitField0_ & ~0x00000020); - autoAck_ = false; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Get) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + destination_ = ""; - static { - defaultInstance = new Get(true); - defaultInstance.initFields(); + clientId_ = ""; + + fetchSize_ = 0; + + timeoutPresentCase_ = 0; + timeoutPresent_ = null; + unitPresentCase_ = 0; + unitPresent_ = null; + autoAckPresentCase_ = 0; + autoAckPresent_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Get getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Get.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Get build() { + com.alibaba.otter.canal.protocol.CanalPacket.Get result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Get) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Get buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Get result = new com.alibaba.otter.canal.protocol.CanalPacket.Get(this); + result.destination_ = destination_; + result.clientId_ = clientId_; + result.fetchSize_ = fetchSize_; + if (timeoutPresentCase_ == 4) { + result.timeoutPresent_ = timeoutPresent_; + } + if (unitPresentCase_ == 5) { + result.unitPresent_ = unitPresent_; + } + if (autoAckPresentCase_ == 6) { + result.autoAckPresent_ = autoAckPresent_; + } + result.timeoutPresentCase_ = timeoutPresentCase_; + result.unitPresentCase_ = unitPresentCase_; + result.autoAckPresentCase_ = autoAckPresentCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Get) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Get)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Get other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Get.getDefaultInstance()) return this; + if (!other.getDestination().isEmpty()) { + destination_ = other.destination_; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + onChanged(); + } + if (other.getFetchSize() != 0) { + setFetchSize(other.getFetchSize()); + } + switch (other.getTimeoutPresentCase()) { + case TIMEOUT: { + setTimeout(other.getTimeout()); + break; + } + case TIMEOUTPRESENT_NOT_SET: { + break; + } + } + switch (other.getUnitPresentCase()) { + case UNIT: { + setUnit(other.getUnit()); + break; + } + case UNITPRESENT_NOT_SET: { + break; + } + } + switch (other.getAutoAckPresentCase()) { + case AUTO_ACK: { + setAutoAck(other.getAutoAck()); + break; + } + case AUTOACKPRESENT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Get parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Get) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int timeoutPresentCase_ = 0; + private java.lang.Object timeoutPresent_; + public TimeoutPresentCase + getTimeoutPresentCase() { + return TimeoutPresentCase.forNumber( + timeoutPresentCase_); + } + + public Builder clearTimeoutPresent() { + timeoutPresentCase_ = 0; + timeoutPresent_ = null; + onChanged(); + return this; + } + + private int unitPresentCase_ = 0; + private java.lang.Object unitPresent_; + public UnitPresentCase + getUnitPresentCase() { + return UnitPresentCase.forNumber( + unitPresentCase_); + } + + public Builder clearUnitPresent() { + unitPresentCase_ = 0; + unitPresent_ = null; + onChanged(); + return this; + } + + private int autoAckPresentCase_ = 0; + private java.lang.Object autoAckPresent_; + public AutoAckPresentCase + getAutoAckPresentCase() { + return AutoAckPresentCase.forNumber( + autoAckPresentCase_); + } + + public Builder clearAutoAckPresent() { + autoAckPresentCase_ = 0; + autoAckPresent_ = null; + onChanged(); + return this; + } + + + private java.lang.Object destination_ = ""; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string destination = 1; + */ + public Builder setDestination( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + destination_ = value; + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder clearDestination() { + + destination_ = getDefaultInstance().getDestination(); + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder setDestinationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + destination_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string client_id = 2; + */ + public Builder setClientId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientId_ = value; + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder clearClientId() { + + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder setClientIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientId_ = value; + onChanged(); + return this; + } + + private int fetchSize_ ; + /** + * int32 fetch_size = 3; + */ + public int getFetchSize() { + return fetchSize_; + } + /** + * int32 fetch_size = 3; + */ + public Builder setFetchSize(int value) { + + fetchSize_ = value; + onChanged(); + return this; + } + /** + * int32 fetch_size = 3; + */ + public Builder clearFetchSize() { + + fetchSize_ = 0; + onChanged(); + return this; + } + + /** + *
    +       * 默认-1时代表不控制
    +       * 
    + * + * int64 timeout = 4; + */ + public long getTimeout() { + if (timeoutPresentCase_ == 4) { + return (java.lang.Long) timeoutPresent_; + } + return 0L; + } + /** + *
    +       * 默认-1时代表不控制
    +       * 
    + * + * int64 timeout = 4; + */ + public Builder setTimeout(long value) { + timeoutPresentCase_ = 4; + timeoutPresent_ = value; + onChanged(); + return this; + } + /** + *
    +       * 默认-1时代表不控制
    +       * 
    + * + * int64 timeout = 4; + */ + public Builder clearTimeout() { + if (timeoutPresentCase_ == 4) { + timeoutPresentCase_ = 0; + timeoutPresent_ = null; + onChanged(); + } + return this; + } + + /** + *
    +       * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    +       * 
    + * + * int32 unit = 5; + */ + public int getUnit() { + if (unitPresentCase_ == 5) { + return (java.lang.Integer) unitPresent_; + } + return 0; + } + /** + *
    +       * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    +       * 
    + * + * int32 unit = 5; + */ + public Builder setUnit(int value) { + unitPresentCase_ = 5; + unitPresent_ = value; + onChanged(); + return this; + } + /** + *
    +       * 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天
    +       * 
    + * + * int32 unit = 5; + */ + public Builder clearUnit() { + if (unitPresentCase_ == 5) { + unitPresentCase_ = 0; + unitPresent_ = null; + onChanged(); + } + return this; + } + + /** + *
    +       * 是否自动ack
    +       * 
    + * + * bool auto_ack = 6; + */ + public boolean getAutoAck() { + if (autoAckPresentCase_ == 6) { + return (java.lang.Boolean) autoAckPresent_; + } + return false; + } + /** + *
    +       * 是否自动ack
    +       * 
    + * + * bool auto_ack = 6; + */ + public Builder setAutoAck(boolean value) { + autoAckPresentCase_ = 6; + autoAckPresent_ = value; + onChanged(); + return this; + } + /** + *
    +       * 是否自动ack
    +       * 
    + * + * bool auto_ack = 6; + */ + public Builder clearAutoAck() { + if (autoAckPresentCase_ == 6) { + autoAckPresentCase_ = 0; + autoAckPresent_ = null; + onChanged(); + } + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Get) } - public interface MessagesOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Messages) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 batch_id = 1; - */ - boolean hasBatchId(); - - /** - * optional int64 batch_id = 1; - */ - long getBatchId(); - - /** - * repeated bytes messages = 2; - */ - java.util.List getMessagesList(); - - /** - * repeated bytes messages = 2; - */ - int getMessagesCount(); - - /** - * repeated bytes messages = 2; - */ - com.google.protobuf.ByteString getMessages(int index); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Get) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Get DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Get(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Get getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Get parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Get(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Get getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface MessagesOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Messages) + com.google.protobuf.MessageOrBuilder { + + /** + * int64 batch_id = 1; + */ + long getBatchId(); + + /** + * repeated bytes messages = 2; + */ + java.util.List getMessagesList(); + /** + * repeated bytes messages = 2; + */ + int getMessagesCount(); + /** + * repeated bytes messages = 2; + */ + com.google.protobuf.ByteString getMessages(int index); + } + /** + *
    +   * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Messages} + */ + public static final class Messages extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Messages) + MessagesOrBuilder { + private static final long serialVersionUID = 0L; + // Use Messages.newBuilder() to construct. + private Messages(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Messages() { + batchId_ = 0L; + messages_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Messages( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + batchId_ = input.readInt64(); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + messages_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + messages_.add(input.readBytes()); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + messages_ = java.util.Collections.unmodifiableList(messages_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Messages.class, com.alibaba.otter.canal.protocol.CanalPacket.Messages.Builder.class); + } + + private int bitField0_; + public static final int BATCH_ID_FIELD_NUMBER = 1; + private long batchId_; + /** + * int64 batch_id = 1; + */ + public long getBatchId() { + return batchId_; + } + + public static final int MESSAGES_FIELD_NUMBER = 2; + private java.util.List messages_; + /** + * repeated bytes messages = 2; + */ + public java.util.List + getMessagesList() { + return messages_; + } + /** + * repeated bytes messages = 2; + */ + public int getMessagesCount() { + return messages_.size(); + } + /** + * repeated bytes messages = 2; + */ + public com.google.protobuf.ByteString getMessages(int index) { + return messages_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (batchId_ != 0L) { + output.writeInt64(1, batchId_); + } + for (int i = 0; i < messages_.size(); i++) { + output.writeBytes(2, messages_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (batchId_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, batchId_); + } + { + int dataSize = 0; + for (int i = 0; i < messages_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(messages_.get(i)); + } + size += dataSize; + size += 1 * getMessagesList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Messages)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Messages other = (com.alibaba.otter.canal.protocol.CanalPacket.Messages) obj; + + boolean result = true; + result = result && (getBatchId() + == other.getBatchId()); + result = result && getMessagesList() + .equals(other.getMessagesList()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + BATCH_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getBatchId()); + if (getMessagesCount() > 0) { + hash = (37 * hash) + MESSAGES_FIELD_NUMBER; + hash = (53 * hash) + getMessagesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Messages prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Messages} - * *
          * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Messages} */ - public static final class Messages extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Messages) - MessagesOrBuilder { - - // Use Messages.newBuilder() to construct. - private Messages(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Messages(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Messages defaultInstance; - - public static Messages getDefaultInstance() { - return defaultInstance; - } - - public Messages getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Messages(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - batchId_ = input.readInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - messages_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - messages_.add(input.readBytes()); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - messages_ = java.util.Collections.unmodifiableList(messages_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Messages.class, - com.alibaba.otter.canal.protocol.CanalPacket.Messages.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Messages parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Messages(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int BATCH_ID_FIELD_NUMBER = 1; - private long batchId_; - - /** - * optional int64 batch_id = 1; - */ - public boolean hasBatchId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int64 batch_id = 1; - */ - public long getBatchId() { - return batchId_; - } - - public static final int MESSAGES_FIELD_NUMBER = 2; - private java.util.List messages_; - - /** - * repeated bytes messages = 2; - */ - public java.util.List getMessagesList() { - return messages_; - } - - /** - * repeated bytes messages = 2; - */ - public int getMessagesCount() { - return messages_.size(); - } - - /** - * repeated bytes messages = 2; - */ - public com.google.protobuf.ByteString getMessages(int index) { - return messages_.get(index); - } - - private void initFields() { - batchId_ = 0L; - messages_ = java.util.Collections.emptyList(); - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt64(1, batchId_); - } - for (int i = 0; i < messages_.size(); i++) { - output.writeBytes(2, messages_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, batchId_); - } - { - int dataSize = 0; - for (int i = 0; i < messages_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream.computeBytesSizeNoTag(messages_.get(i)); - } - size += dataSize; - size += 1 * getMessagesList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Messages parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Messages prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Messages} - * - *
    -         * 
    - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Messages) com.alibaba.otter.canal.protocol.CanalPacket.MessagesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Messages.class, com.alibaba.otter.canal.protocol.CanalPacket.Messages.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Messages.class, - com.alibaba.otter.canal.protocol.CanalPacket.Messages.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Messages.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Messages.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - batchId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - messages_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Messages getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Messages.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Messages build() { - com.alibaba.otter.canal.protocol.CanalPacket.Messages result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Messages buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Messages result = new com.alibaba.otter.canal.protocol.CanalPacket.Messages(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.batchId_ = batchId_; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - messages_ = java.util.Collections.unmodifiableList(messages_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.messages_ = messages_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Messages) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Messages) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Messages other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Messages.getDefaultInstance()) return this; - if (other.hasBatchId()) { - setBatchId(other.getBatchId()); - } - if (!other.messages_.isEmpty()) { - if (messages_.isEmpty()) { - messages_ = other.messages_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureMessagesIsMutable(); - messages_.addAll(other.messages_); - } - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Messages parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Messages) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private long batchId_; - - /** - * optional int64 batch_id = 1; - */ - public boolean hasBatchId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional int64 batch_id = 1; - */ - public long getBatchId() { - return batchId_; - } - - /** - * optional int64 batch_id = 1; - */ - public Builder setBatchId(long value) { - bitField0_ |= 0x00000001; - batchId_ = value; - onChanged(); - return this; - } - - /** - * optional int64 batch_id = 1; - */ - public Builder clearBatchId() { - bitField0_ = (bitField0_ & ~0x00000001); - batchId_ = 0L; - onChanged(); - return this; - } - - private java.util.List messages_ = java.util.Collections.emptyList(); - - private void ensureMessagesIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - messages_ = new java.util.ArrayList(messages_); - bitField0_ |= 0x00000002; - } - } - - /** - * repeated bytes messages = 2; - */ - public java.util.List getMessagesList() { - return java.util.Collections.unmodifiableList(messages_); - } - - /** - * repeated bytes messages = 2; - */ - public int getMessagesCount() { - return messages_.size(); - } - - /** - * repeated bytes messages = 2; - */ - public com.google.protobuf.ByteString getMessages(int index) { - return messages_.get(index); - } - - /** - * repeated bytes messages = 2; - */ - public Builder setMessages(int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureMessagesIsMutable(); - messages_.set(index, value); - onChanged(); - return this; - } - - /** - * repeated bytes messages = 2; - */ - public Builder addMessages(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureMessagesIsMutable(); - messages_.add(value); - onChanged(); - return this; - } - - /** - * repeated bytes messages = 2; - */ - public Builder addAllMessages(java.lang.Iterable values) { - ensureMessagesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, messages_); - onChanged(); - return this; - } - - /** - * repeated bytes messages = 2; - */ - public Builder clearMessages() { - messages_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Messages) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + batchId_ = 0L; - static { - defaultInstance = new Messages(true); - defaultInstance.initFields(); + messages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Messages getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Messages.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Messages build() { + com.alibaba.otter.canal.protocol.CanalPacket.Messages result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Messages) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Messages buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Messages result = new com.alibaba.otter.canal.protocol.CanalPacket.Messages(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.batchId_ = batchId_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + messages_ = java.util.Collections.unmodifiableList(messages_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.messages_ = messages_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Messages) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Messages)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Messages other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Messages.getDefaultInstance()) return this; + if (other.getBatchId() != 0L) { + setBatchId(other.getBatchId()); + } + if (!other.messages_.isEmpty()) { + if (messages_.isEmpty()) { + messages_ = other.messages_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureMessagesIsMutable(); + messages_.addAll(other.messages_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Messages parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Messages) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private long batchId_ ; + /** + * int64 batch_id = 1; + */ + public long getBatchId() { + return batchId_; + } + /** + * int64 batch_id = 1; + */ + public Builder setBatchId(long value) { + + batchId_ = value; + onChanged(); + return this; + } + /** + * int64 batch_id = 1; + */ + public Builder clearBatchId() { + + batchId_ = 0L; + onChanged(); + return this; + } + + private java.util.List messages_ = java.util.Collections.emptyList(); + private void ensureMessagesIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + messages_ = new java.util.ArrayList(messages_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated bytes messages = 2; + */ + public java.util.List + getMessagesList() { + return java.util.Collections.unmodifiableList(messages_); + } + /** + * repeated bytes messages = 2; + */ + public int getMessagesCount() { + return messages_.size(); + } + /** + * repeated bytes messages = 2; + */ + public com.google.protobuf.ByteString getMessages(int index) { + return messages_.get(index); + } + /** + * repeated bytes messages = 2; + */ + public Builder setMessages( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMessagesIsMutable(); + messages_.set(index, value); + onChanged(); + return this; + } + /** + * repeated bytes messages = 2; + */ + public Builder addMessages(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMessagesIsMutable(); + messages_.add(value); + onChanged(); + return this; + } + /** + * repeated bytes messages = 2; + */ + public Builder addAllMessages( + java.lang.Iterable values) { + ensureMessagesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, messages_); + onChanged(); + return this; + } + /** + * repeated bytes messages = 2; + */ + public Builder clearMessages() { + messages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Messages) } - public interface DumpOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Dump) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string journal = 1; - */ - boolean hasJournal(); - - /** - * optional string journal = 1; - */ - java.lang.String getJournal(); - - /** - * optional string journal = 1; - */ - com.google.protobuf.ByteString getJournalBytes(); - - /** - * optional int64 position = 2; - */ - boolean hasPosition(); - - /** - * optional int64 position = 2; - */ - long getPosition(); - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - boolean hasTimestamp(); - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - long getTimestamp(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Messages) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Messages DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Messages(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Messages getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Messages parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Messages(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Messages getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface DumpOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.Dump) + com.google.protobuf.MessageOrBuilder { + + /** + * string journal = 1; + */ + java.lang.String getJournal(); + /** + * string journal = 1; + */ + com.google.protobuf.ByteString + getJournalBytes(); + + /** + * int64 position = 2; + */ + long getPosition(); + + /** + * int64 timestamp = 3; + */ + long getTimestamp(); + + public com.alibaba.otter.canal.protocol.CanalPacket.Dump.TimestampPresentCase getTimestampPresentCase(); + } + /** + *
    +   * TBD when new packets are required
    +   * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Dump} + */ + public static final class Dump extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Dump) + DumpOrBuilder { + private static final long serialVersionUID = 0L; + // Use Dump.newBuilder() to construct. + private Dump(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Dump() { + journal_ = ""; + position_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Dump( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + journal_ = s; + break; + } + case 16: { + + position_ = input.readInt64(); + break; + } + case 24: { + timestampPresentCase_ = 3; + timestampPresent_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Dump.class, com.alibaba.otter.canal.protocol.CanalPacket.Dump.Builder.class); + } + + private int timestampPresentCase_ = 0; + private java.lang.Object timestampPresent_; + public enum TimestampPresentCase + implements com.google.protobuf.Internal.EnumLite { + TIMESTAMP(3), + TIMESTAMPPRESENT_NOT_SET(0); + private final int value; + private TimestampPresentCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TimestampPresentCase valueOf(int value) { + return forNumber(value); + } + + public static TimestampPresentCase forNumber(int value) { + switch (value) { + case 3: return TIMESTAMP; + case 0: return TIMESTAMPPRESENT_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public TimestampPresentCase + getTimestampPresentCase() { + return TimestampPresentCase.forNumber( + timestampPresentCase_); + } + + public static final int JOURNAL_FIELD_NUMBER = 1; + private volatile java.lang.Object journal_; + /** + * string journal = 1; + */ + public java.lang.String getJournal() { + java.lang.Object ref = journal_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + journal_ = s; + return s; + } + } + /** + * string journal = 1; + */ + public com.google.protobuf.ByteString + getJournalBytes() { + java.lang.Object ref = journal_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + journal_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int POSITION_FIELD_NUMBER = 2; + private long position_; + /** + * int64 position = 2; + */ + public long getPosition() { + return position_; + } + + public static final int TIMESTAMP_FIELD_NUMBER = 3; + /** + * int64 timestamp = 3; + */ + public long getTimestamp() { + if (timestampPresentCase_ == 3) { + return (java.lang.Long) timestampPresent_; + } + return 0L; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getJournalBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, journal_); + } + if (position_ != 0L) { + output.writeInt64(2, position_); + } + if (timestampPresentCase_ == 3) { + output.writeInt64( + 3, (long)((java.lang.Long) timestampPresent_)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getJournalBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, journal_); + } + if (position_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, position_); + } + if (timestampPresentCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size( + 3, (long)((java.lang.Long) timestampPresent_)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.Dump)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.Dump other = (com.alibaba.otter.canal.protocol.CanalPacket.Dump) obj; + + boolean result = true; + result = result && getJournal() + .equals(other.getJournal()); + result = result && (getPosition() + == other.getPosition()); + result = result && getTimestampPresentCase().equals( + other.getTimestampPresentCase()); + if (!result) return false; + switch (timestampPresentCase_) { + case 3: + result = result && (getTimestamp() + == other.getTimestamp()); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + JOURNAL_FIELD_NUMBER; + hash = (53 * hash) + getJournal().hashCode(); + hash = (37 * hash) + POSITION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getPosition()); + switch (timestampPresentCase_) { + case 3: + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTimestamp()); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Dump prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Dump} - * *
          * TBD when new packets are required
          * 
    + * + * Protobuf type {@code com.alibaba.otter.canal.protocol.Dump} */ - public static final class Dump extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Dump) - DumpOrBuilder { - - // Use Dump.newBuilder() to construct. - private Dump(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private Dump(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final Dump defaultInstance; - - public static Dump getDefaultInstance() { - return defaultInstance; - } - - public Dump getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Dump(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - journal_ = bs; - break; - } - case 16: { - bitField0_ |= 0x00000002; - position_ = input.readInt64(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - timestamp_ = input.readInt64(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Dump.class, - com.alibaba.otter.canal.protocol.CanalPacket.Dump.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public Dump parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Dump(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int JOURNAL_FIELD_NUMBER = 1; - private java.lang.Object journal_; - - /** - * optional string journal = 1; - */ - public boolean hasJournal() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string journal = 1; - */ - public java.lang.String getJournal() { - java.lang.Object ref = journal_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - journal_ = s; - } - return s; - } - } - - /** - * optional string journal = 1; - */ - public com.google.protobuf.ByteString getJournalBytes() { - java.lang.Object ref = journal_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - journal_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int POSITION_FIELD_NUMBER = 2; - private long position_; - - /** - * optional int64 position = 2; - */ - public boolean hasPosition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional int64 position = 2; - */ - public long getPosition() { - return position_; - } - - public static final int TIMESTAMP_FIELD_NUMBER = 3; - private long timestamp_; - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - public boolean hasTimestamp() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - public long getTimestamp() { - return timestamp_; - } - - private void initFields() { - journal_ = ""; - position_ = 0L; - timestamp_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getJournalBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, position_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, timestamp_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getJournalBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, position_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, timestamp_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.Dump parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.Dump prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.Dump} - * - *
    -         * TBD when new packets are required
    -         * 
    - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Dump) com.alibaba.otter.canal.protocol.CanalPacket.DumpOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.Dump.class, com.alibaba.otter.canal.protocol.CanalPacket.Dump.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.Dump.class, - com.alibaba.otter.canal.protocol.CanalPacket.Dump.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.Dump.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.Dump.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - journal_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - position_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - timestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Dump getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.Dump.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Dump build() { - com.alibaba.otter.canal.protocol.CanalPacket.Dump result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.Dump buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.Dump result = new com.alibaba.otter.canal.protocol.CanalPacket.Dump(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.journal_ = journal_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.position_ = position_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.timestamp_ = timestamp_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Dump) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Dump) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Dump other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.Dump.getDefaultInstance()) return this; - if (other.hasJournal()) { - bitField0_ |= 0x00000001; - journal_ = other.journal_; - onChanged(); - } - if (other.hasPosition()) { - setPosition(other.getPosition()); - } - if (other.hasTimestamp()) { - setTimestamp(other.getTimestamp()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.Dump parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Dump) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object journal_ = ""; - - /** - * optional string journal = 1; - */ - public boolean hasJournal() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string journal = 1; - */ - public java.lang.String getJournal() { - java.lang.Object ref = journal_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - journal_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string journal = 1; - */ - public com.google.protobuf.ByteString getJournalBytes() { - java.lang.Object ref = journal_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - journal_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string journal = 1; - */ - public Builder setJournal(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - journal_ = value; - onChanged(); - return this; - } - - /** - * optional string journal = 1; - */ - public Builder clearJournal() { - bitField0_ = (bitField0_ & ~0x00000001); - journal_ = getDefaultInstance().getJournal(); - onChanged(); - return this; - } - - /** - * optional string journal = 1; - */ - public Builder setJournalBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - journal_ = value; - onChanged(); - return this; - } - - private long position_; - - /** - * optional int64 position = 2; - */ - public boolean hasPosition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional int64 position = 2; - */ - public long getPosition() { - return position_; - } - - /** - * optional int64 position = 2; - */ - public Builder setPosition(long value) { - bitField0_ |= 0x00000002; - position_ = value; - onChanged(); - return this; - } - - /** - * optional int64 position = 2; - */ - public Builder clearPosition() { - bitField0_ = (bitField0_ & ~0x00000002); - position_ = 0L; - onChanged(); - return this; - } - - private long timestamp_; - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - public boolean hasTimestamp() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - public long getTimestamp() { - return timestamp_; - } - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - public Builder setTimestamp(long value) { - bitField0_ |= 0x00000004; - timestamp_ = value; - onChanged(); - return this; - } - - /** - * optional int64 timestamp = 3 [default = 0]; - */ - public Builder clearTimestamp() { - bitField0_ = (bitField0_ & ~0x00000004); - timestamp_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Dump) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + journal_ = ""; - static { - defaultInstance = new Dump(true); - defaultInstance.initFields(); + position_ = 0L; + + timestampPresentCase_ = 0; + timestampPresent_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Dump getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.Dump.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Dump build() { + com.alibaba.otter.canal.protocol.CanalPacket.Dump result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Dump) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Dump buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.Dump result = new com.alibaba.otter.canal.protocol.CanalPacket.Dump(this); + result.journal_ = journal_; + result.position_ = position_; + if (timestampPresentCase_ == 3) { + result.timestampPresent_ = timestampPresent_; + } + result.timestampPresentCase_ = timestampPresentCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.Dump) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.Dump)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.Dump other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.Dump.getDefaultInstance()) return this; + if (!other.getJournal().isEmpty()) { + journal_ = other.journal_; + onChanged(); + } + if (other.getPosition() != 0L) { + setPosition(other.getPosition()); + } + switch (other.getTimestampPresentCase()) { + case TIMESTAMP: { + setTimestamp(other.getTimestamp()); + break; + } + case TIMESTAMPPRESENT_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.Dump parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.Dump) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int timestampPresentCase_ = 0; + private java.lang.Object timestampPresent_; + public TimestampPresentCase + getTimestampPresentCase() { + return TimestampPresentCase.forNumber( + timestampPresentCase_); + } + + public Builder clearTimestampPresent() { + timestampPresentCase_ = 0; + timestampPresent_ = null; + onChanged(); + return this; + } + + + private java.lang.Object journal_ = ""; + /** + * string journal = 1; + */ + public java.lang.String getJournal() { + java.lang.Object ref = journal_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + journal_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string journal = 1; + */ + public com.google.protobuf.ByteString + getJournalBytes() { + java.lang.Object ref = journal_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + journal_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string journal = 1; + */ + public Builder setJournal( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + journal_ = value; + onChanged(); + return this; + } + /** + * string journal = 1; + */ + public Builder clearJournal() { + + journal_ = getDefaultInstance().getJournal(); + onChanged(); + return this; + } + /** + * string journal = 1; + */ + public Builder setJournalBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + journal_ = value; + onChanged(); + return this; + } + + private long position_ ; + /** + * int64 position = 2; + */ + public long getPosition() { + return position_; + } + /** + * int64 position = 2; + */ + public Builder setPosition(long value) { + + position_ = value; + onChanged(); + return this; + } + /** + * int64 position = 2; + */ + public Builder clearPosition() { + + position_ = 0L; + onChanged(); + return this; + } + + /** + * int64 timestamp = 3; + */ + public long getTimestamp() { + if (timestampPresentCase_ == 3) { + return (java.lang.Long) timestampPresent_; + } + return 0L; + } + /** + * int64 timestamp = 3; + */ + public Builder setTimestamp(long value) { + timestampPresentCase_ = 3; + timestampPresent_ = value; + onChanged(); + return this; + } + /** + * int64 timestamp = 3; + */ + public Builder clearTimestamp() { + if (timestampPresentCase_ == 3) { + timestampPresentCase_ = 0; + timestampPresent_ = null; + onChanged(); + } + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Dump) } - public interface ClientRollbackOrBuilder extends - // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.ClientRollback) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string destination = 1; - */ - boolean hasDestination(); - - /** - * optional string destination = 1; - */ - java.lang.String getDestination(); - - /** - * optional string destination = 1; - */ - com.google.protobuf.ByteString getDestinationBytes(); - - /** - * optional string client_id = 2; - */ - boolean hasClientId(); - - /** - * optional string client_id = 2; - */ - java.lang.String getClientId(); - - /** - * optional string client_id = 2; - */ - com.google.protobuf.ByteString getClientIdBytes(); - - /** - * optional int64 batch_id = 3; - */ - boolean hasBatchId(); - - /** - * optional int64 batch_id = 3; - */ - long getBatchId(); + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Dump) + private static final com.alibaba.otter.canal.protocol.CanalPacket.Dump DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.Dump(); } + public static com.alibaba.otter.canal.protocol.CanalPacket.Dump getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Dump parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Dump(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.Dump getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ClientRollbackOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.alibaba.otter.canal.protocol.ClientRollback) + com.google.protobuf.MessageOrBuilder { + + /** + * string destination = 1; + */ + java.lang.String getDestination(); + /** + * string destination = 1; + */ + com.google.protobuf.ByteString + getDestinationBytes(); + + /** + * string client_id = 2; + */ + java.lang.String getClientId(); + /** + * string client_id = 2; + */ + com.google.protobuf.ByteString + getClientIdBytes(); + + /** + * int64 batch_id = 3; + */ + long getBatchId(); + } + /** + * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientRollback} + */ + public static final class ClientRollback extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.ClientRollback) + ClientRollbackOrBuilder { + private static final long serialVersionUID = 0L; + // Use ClientRollback.newBuilder() to construct. + private ClientRollback(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClientRollback() { + destination_ = ""; + clientId_ = ""; + batchId_ = 0L; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClientRollback( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + destination_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + clientId_ = s; + break; + } + case 24: { + + batchId_ = input.readInt64(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.class, com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.Builder.class); + } + + public static final int DESTINATION_FIELD_NUMBER = 1; + private volatile java.lang.Object destination_; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object clientId_; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BATCH_ID_FIELD_NUMBER = 3; + private long batchId_; + /** + * int64 batch_id = 3; + */ + public long getBatchId() { + return batchId_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, clientId_); + } + if (batchId_ != 0L) { + output.writeInt64(3, batchId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, destination_); + } + if (!getClientIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, clientId_); + } + if (batchId_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, batchId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback)) { + return super.equals(obj); + } + com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback other = (com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback) obj; + + boolean result = true; + result = result && getDestination() + .equals(other.getDestination()); + result = result && getClientId() + .equals(other.getClientId()); + result = result && (getBatchId() + == other.getBatchId()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + BATCH_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getBatchId()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientRollback} */ - public static final class ClientRollback extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.ClientRollback) - ClientRollbackOrBuilder { - - // Use ClientRollback.newBuilder() to construct. - private ClientRollback(com.google.protobuf.GeneratedMessage.Builder builder){ - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - - private ClientRollback(boolean noInit){ - this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - - private static final ClientRollback defaultInstance; - - public static ClientRollback getDefaultInstance() { - return defaultInstance; - } - - public ClientRollback getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ClientRollback(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException{ - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - destination_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - clientId_ = bs; - break; - } - case 24: { - bitField0_ |= 0x00000004; - batchId_ = input.readInt64(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.class, - com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { - - public ClientRollback parsePartialFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ClientRollback(input, - extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int DESTINATION_FIELD_NUMBER = 1; - private java.lang.Object destination_; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CLIENT_ID_FIELD_NUMBER = 2; - private java.lang.Object clientId_; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BATCH_ID_FIELD_NUMBER = 3; - private long batchId_; - - /** - * optional int64 batch_id = 3; - */ - public boolean hasBatchId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int64 batch_id = 3; - */ - public long getBatchId() { - return batchId_; - } - - private void initFields() { - destination_ = ""; - clientId_ = ""; - batchId_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, batchId_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getDestinationBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getClientIdBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, batchId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - - public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - /** - * Protobuf type {@code com.alibaba.otter.canal.protocol.ClientRollback} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.ClientRollback) com.alibaba.otter.canal.protocol.CanalPacket.ClientRollbackOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; + } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; - } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.class, com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.Builder.class); + } - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable.ensureFieldAccessorsInitialized(com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.class, - com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.Builder.class); - } + // Construct using com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } - // Construct using - // com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - destination_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - clientId_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - batchId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback getDefaultInstanceForType() { - return com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.getDefaultInstance(); - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback build() { - com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback buildPartial() { - com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback result = new com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.destination_ = destination_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.clientId_ = clientId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.batchId_ = batchId_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback) { - return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback other) { - if (other == com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.getDefaultInstance()) return this; - if (other.hasDestination()) { - bitField0_ |= 0x00000001; - destination_ = other.destination_; - onChanged(); - } - if (other.hasClientId()) { - bitField0_ |= 0x00000002; - clientId_ = other.clientId_; - onChanged(); - } - if (other.hasBatchId()) { - setBatchId(other.getBatchId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private int bitField0_; - - private java.lang.Object destination_ = ""; - - /** - * optional string destination = 1; - */ - public boolean hasDestination() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - /** - * optional string destination = 1; - */ - public java.lang.String getDestination() { - java.lang.Object ref = destination_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - destination_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string destination = 1; - */ - public com.google.protobuf.ByteString getDestinationBytes() { - java.lang.Object ref = destination_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - destination_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string destination = 1; - */ - public Builder setDestination(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder clearDestination() { - bitField0_ = (bitField0_ & ~0x00000001); - destination_ = getDefaultInstance().getDestination(); - onChanged(); - return this; - } - - /** - * optional string destination = 1; - */ - public Builder setDestinationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - destination_ = value; - onChanged(); - return this; - } - - private java.lang.Object clientId_ = ""; - - /** - * optional string client_id = 2; - */ - public boolean hasClientId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - /** - * optional string client_id = 2; - */ - public java.lang.String getClientId() { - java.lang.Object ref = clientId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - clientId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - - /** - * optional string client_id = 2; - */ - public com.google.protobuf.ByteString getClientIdBytes() { - java.lang.Object ref = clientId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - clientId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - /** - * optional string client_id = 2; - */ - public Builder setClientId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder clearClientId() { - bitField0_ = (bitField0_ & ~0x00000002); - clientId_ = getDefaultInstance().getClientId(); - onChanged(); - return this; - } - - /** - * optional string client_id = 2; - */ - public Builder setClientIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - clientId_ = value; - onChanged(); - return this; - } - - private long batchId_; - - /** - * optional int64 batch_id = 3; - */ - public boolean hasBatchId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - /** - * optional int64 batch_id = 3; - */ - public long getBatchId() { - return batchId_; - } - - /** - * optional int64 batch_id = 3; - */ - public Builder setBatchId(long value) { - bitField0_ |= 0x00000004; - batchId_ = value; - onChanged(); - return this; - } - - /** - * optional int64 batch_id = 3; - */ - public Builder clearBatchId() { - bitField0_ = (bitField0_ & ~0x00000004); - batchId_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.ClientRollback) + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { } + } + @java.lang.Override + public Builder clear() { + super.clear(); + destination_ = ""; - static { - defaultInstance = new ClientRollback(true); - defaultInstance.initFields(); + clientId_ = ""; + + batchId_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback getDefaultInstanceForType() { + return com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.getDefaultInstance(); + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback build() { + com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; + } - // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.ClientRollback) + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback buildPartial() { + com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback result = new com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback(this); + result.destination_ = destination_; + result.clientId_ = clientId_; + result.batchId_ = batchId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback) { + return mergeFrom((com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback other) { + if (other == com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback.getDefaultInstance()) return this; + if (!other.getDestination().isEmpty()) { + destination_ = other.destination_; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + onChanged(); + } + if (other.getBatchId() != 0L) { + setBatchId(other.getBatchId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object destination_ = ""; + /** + * string destination = 1; + */ + public java.lang.String getDestination() { + java.lang.Object ref = destination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + destination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string destination = 1; + */ + public com.google.protobuf.ByteString + getDestinationBytes() { + java.lang.Object ref = destination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + destination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string destination = 1; + */ + public Builder setDestination( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + destination_ = value; + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder clearDestination() { + + destination_ = getDefaultInstance().getDestination(); + onChanged(); + return this; + } + /** + * string destination = 1; + */ + public Builder setDestinationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + destination_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + /** + * string client_id = 2; + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string client_id = 2; + */ + public com.google.protobuf.ByteString + getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string client_id = 2; + */ + public Builder setClientId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientId_ = value; + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder clearClientId() { + + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + /** + * string client_id = 2; + */ + public Builder setClientIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientId_ = value; + onChanged(); + return this; + } + + private long batchId_ ; + /** + * int64 batch_id = 3; + */ + public long getBatchId() { + return batchId_; + } + /** + * int64 batch_id = 3; + */ + public Builder setBatchId(long value) { + + batchId_ = value; + onChanged(); + return this; + } + /** + * int64 batch_id = 3; + */ + public Builder clearBatchId() { + + batchId_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.ClientRollback) } - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; - } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.ClientRollback) + private static final com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback DEFAULT_INSTANCE; static { - java.lang.String[] descriptorData = { - "\n\023CanalProtocol.proto\022 com.alibaba.otter" - + ".canal.protocol\"\312\001\n\006Packet\022\030\n\014magic_numb" - + "er\030\001 \001(\005:\00217\022\022\n\007version\030\002 \001(\005:\0011\022:\n\004type" - + "\030\003 \001(\0162,.com.alibaba.otter.canal.protoco" - + "l.PacketType\022H\n\013compression\030\004 \001(\0162-.com." - + "alibaba.otter.canal.protocol.Compression" - + ":\004NONE\022\014\n\004body\030\005 \001(\014\"<\n\tHeartBeat\022\026\n\016sen" - + "d_timestamp\030\001 \001(\003\022\027\n\017start_timestamp\030\002 \001" - + "(\003\"\217\001\n\tHandshake\022$\n\026communication_encodi" - + "ng\030\001 \001(\t:\004utf8\022\r\n\005seeds\030\002 \001(\014\022M\n\026support", - "ed_compressions\030\003 \003(\0162-.com.alibaba.otte" - + "r.canal.protocol.Compression\"\274\001\n\nClientA" - + "uth\022\020\n\010username\030\001 \001(\t\022\020\n\010password\030\002 \001(\014\022" - + "\033\n\020net_read_timeout\030\003 \001(\005:\0010\022\034\n\021net_writ" - + "e_timeout\030\004 \001(\005:\0010\022\023\n\013destination\030\005 \001(\t\022" - + "\021\n\tclient_id\030\006 \001(\t\022\016\n\006filter\030\007 \001(\t\022\027\n\017st" - + "art_timestamp\030\010 \001(\003\"3\n\003Ack\022\025\n\nerror_code" - + "\030\001 \001(\005:\0010\022\025\n\rerror_message\030\002 \001(\t\"E\n\tClie" - + "ntAck\022\023\n\013destination\030\001 \001(\t\022\021\n\tclient_id\030" - + "\002 \001(\t\022\020\n\010batch_id\030\003 \001(\003\"=\n\003Sub\022\023\n\013destin", - "ation\030\001 \001(\t\022\021\n\tclient_id\030\002 \001(\t\022\016\n\006filter" - + "\030\007 \001(\t\"?\n\005Unsub\022\023\n\013destination\030\001 \001(\t\022\021\n\t" - + "client_id\030\002 \001(\t\022\016\n\006filter\030\007 \001(\t\"\200\001\n\003Get\022" - + "\023\n\013destination\030\001 \001(\t\022\021\n\tclient_id\030\002 \001(\t\022" - + "\022\n\nfetch_size\030\003 \001(\005\022\023\n\007timeout\030\004 \001(\003:\002-1" - + "\022\017\n\004unit\030\005 \001(\005:\0012\022\027\n\010auto_ack\030\006 \001(\010:\005fal" - + "se\".\n\010Messages\022\020\n\010batch_id\030\001 \001(\003\022\020\n\010mess" - + "ages\030\002 \003(\014\"?\n\004Dump\022\017\n\007journal\030\001 \001(\t\022\020\n\010p" - + "osition\030\002 \001(\003\022\024\n\ttimestamp\030\003 \001(\003:\0010\"J\n\016C" - + "lientRollback\022\023\n\013destination\030\001 \001(\t\022\021\n\tcl", - "ient_id\030\002 \001(\t\022\020\n\010batch_id\030\003 \001(\003*4\n\013Compr" - + "ession\022\010\n\004NONE\020\001\022\010\n\004ZLIB\020\002\022\010\n\004GZIP\020\003\022\007\n\003" - + "LZF\020\004*\305\001\n\nPacketType\022\r\n\tHANDSHAKE\020\001\022\030\n\024C" - + "LIENTAUTHENTICATION\020\002\022\007\n\003ACK\020\003\022\020\n\014SUBSCR" - + "IPTION\020\004\022\022\n\016UNSUBSCRIPTION\020\005\022\007\n\003GET\020\006\022\014\n" - + "\010MESSAGES\020\007\022\r\n\tCLIENTACK\020\010\022\014\n\010SHUTDOWN\020\t" - + "\022\010\n\004DUMP\020\n\022\r\n\tHEARTBEAT\020\013\022\022\n\016CLIENTROLLB" - + "ACK\020\014B1\n com.alibaba.otter.canal.protoco" + "lB\013CanalPacketH\001" }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - - public com.google.protobuf.ExtensionRegistry assignDescriptors(com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] {}, - assigner); - internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor, - new java.lang.String[] { "MagicNumber", "Version", "Type", "Compression", "Body", }); - internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor = getDescriptor().getMessageTypes() - .get(1); - internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor, - new java.lang.String[] { "SendTimestamp", "StartTimestamp", }); - internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor = getDescriptor().getMessageTypes() - .get(2); - internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor, - new java.lang.String[] { "CommunicationEncoding", "Seeds", "SupportedCompressions", }); - internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor = getDescriptor().getMessageTypes() - .get(3); - internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor, - new java.lang.String[] { "Username", "Password", "NetReadTimeout", "NetWriteTimeout", "Destination", - "ClientId", "Filter", "StartTimestamp", }); - internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor = getDescriptor().getMessageTypes().get(4); - internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor, - new java.lang.String[] { "ErrorCode", "ErrorMessage", }); - internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor = getDescriptor().getMessageTypes() - .get(5); - internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor, - new java.lang.String[] { "Destination", "ClientId", "BatchId", }); - internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor = getDescriptor().getMessageTypes().get(6); - internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor, - new java.lang.String[] { "Destination", "ClientId", "Filter", }); - internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor = getDescriptor().getMessageTypes().get(7); - internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor, - new java.lang.String[] { "Destination", "ClientId", "Filter", }); - internal_static_com_alibaba_otter_canal_protocol_Get_descriptor = getDescriptor().getMessageTypes().get(8); - internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Get_descriptor, - new java.lang.String[] { "Destination", "ClientId", "FetchSize", "Timeout", "Unit", "AutoAck", }); - internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor = getDescriptor().getMessageTypes().get(9); - internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor, - new java.lang.String[] { "BatchId", "Messages", }); - internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor = getDescriptor().getMessageTypes().get(10); - internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor, - new java.lang.String[] { "Journal", "Position", "Timestamp", }); - internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor = getDescriptor().getMessageTypes() - .get(11); - internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable(internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor, - new java.lang.String[] { "Destination", "ClientId", "BatchId", }); + DEFAULT_INSTANCE = new com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback(); } - // @@protoc_insertion_point(outer_class_scope) + public static com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClientRollback parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClientRollback(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.alibaba.otter.canal.protocol.CanalPacket.ClientRollback getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Get_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\023CanalProtocol.proto\022 com.alibaba.otter" + + ".canal.protocol\"\205\002\n\006Packet\022\026\n\014magic_numb" + + "er\030\001 \001(\005H\000\022\021\n\007version\030\002 \001(\005H\001\022:\n\004type\030\003 " + + "\001(\0162,.com.alibaba.otter.canal.protocol.P" + + "acketType\022D\n\013compression\030\004 \001(\0162-.com.ali" + + "baba.otter.canal.protocol.CompressionH\002\022" + + "\014\n\004body\030\005 \001(\014B\026\n\024magic_number_presentB\021\n" + + "\017version_presentB\025\n\023compression_present\"" + + "<\n\tHeartBeat\022\026\n\016send_timestamp\030\001 \001(\003\022\027\n\017" + + "start_timestamp\030\002 \001(\003\"\255\001\n\tHandshake\022 \n\026c" + + "ommunication_encoding\030\001 \001(\tH\000\022\r\n\005seeds\030\002" + + " \001(\014\022M\n\026supported_compressions\030\003 \001(\0162-.c" + + "om.alibaba.otter.canal.protocol.Compress" + + "ionB \n\036communication_encoding_present\"\363\001" + + "\n\nClientAuth\022\020\n\010username\030\001 \001(\t\022\020\n\010passwo" + + "rd\030\002 \001(\014\022\032\n\020net_read_timeout\030\003 \001(\005H\000\022\033\n\021" + + "net_write_timeout\030\004 \001(\005H\001\022\023\n\013destination" + + "\030\005 \001(\t\022\021\n\tclient_id\030\006 \001(\t\022\016\n\006filter\030\007 \001(" + + "\t\022\027\n\017start_timestamp\030\010 \001(\003B\032\n\030net_read_t" + + "imeout_presentB\033\n\031net_write_timeout_pres" + + "ent\"H\n\003Ack\022\024\n\nerror_code\030\001 \001(\005H\000\022\025\n\rerro" + + "r_message\030\002 \001(\tB\024\n\022error_code_present\"E\n" + + "\tClientAck\022\023\n\013destination\030\001 \001(\t\022\021\n\tclien" + + "t_id\030\002 \001(\t\022\020\n\010batch_id\030\003 \001(\003\"=\n\003Sub\022\023\n\013d" + + "estination\030\001 \001(\t\022\021\n\tclient_id\030\002 \001(\t\022\016\n\006f" + + "ilter\030\007 \001(\t\"?\n\005Unsub\022\023\n\013destination\030\001 \001(" + + "\t\022\021\n\tclient_id\030\002 \001(\t\022\016\n\006filter\030\007 \001(\t\"\257\001\n" + + "\003Get\022\023\n\013destination\030\001 \001(\t\022\021\n\tclient_id\030\002" + + " \001(\t\022\022\n\nfetch_size\030\003 \001(\005\022\021\n\007timeout\030\004 \001(" + + "\003H\000\022\016\n\004unit\030\005 \001(\005H\001\022\022\n\010auto_ack\030\006 \001(\010H\002B" + + "\021\n\017timeout_presentB\016\n\014unit_presentB\022\n\020au" + + "to_ack_present\".\n\010Messages\022\020\n\010batch_id\030\001" + + " \001(\003\022\020\n\010messages\030\002 \003(\014\"S\n\004Dump\022\017\n\007journa" + + "l\030\001 \001(\t\022\020\n\010position\030\002 \001(\003\022\023\n\ttimestamp\030\003" + + " \001(\003H\000B\023\n\021timestamp_present\"J\n\016ClientRol" + + "lback\022\023\n\013destination\030\001 \001(\t\022\021\n\tclient_id\030" + + "\002 \001(\t\022\020\n\010batch_id\030\003 \001(\003*U\n\013Compression\022\037" + + "\n\033COMPRESSIONCOMPATIBLEPROTO2\020\000\022\010\n\004NONE\020" + + "\001\022\010\n\004ZLIB\020\002\022\010\n\004GZIP\020\003\022\007\n\003LZF\020\004*\346\001\n\nPacke" + + "tType\022\037\n\033PACKAGETYPECOMPATIBLEPROTO2\020\000\022\r" + + "\n\tHANDSHAKE\020\001\022\030\n\024CLIENTAUTHENTICATION\020\002\022" + + "\007\n\003ACK\020\003\022\020\n\014SUBSCRIPTION\020\004\022\022\n\016UNSUBSCRIP" + + "TION\020\005\022\007\n\003GET\020\006\022\014\n\010MESSAGES\020\007\022\r\n\tCLIENTA" + + "CK\020\010\022\014\n\010SHUTDOWN\020\t\022\010\n\004DUMP\020\n\022\r\n\tHEARTBEA" + + "T\020\013\022\022\n\016CLIENTROLLBACK\020\014B1\n com.alibaba.o" + + "tter.canal.protocolB\013CanalPacketH\001b\006prot" + + "o3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_alibaba_otter_canal_protocol_Packet_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Packet_descriptor, + new java.lang.String[] { "MagicNumber", "Version", "Type", "Compression", "Body", "MagicNumberPresent", "VersionPresent", "CompressionPresent", }); + internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_alibaba_otter_canal_protocol_HeartBeat_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_HeartBeat_descriptor, + new java.lang.String[] { "SendTimestamp", "StartTimestamp", }); + internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_alibaba_otter_canal_protocol_Handshake_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Handshake_descriptor, + new java.lang.String[] { "CommunicationEncoding", "Seeds", "SupportedCompressions", "CommunicationEncodingPresent", }); + internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_alibaba_otter_canal_protocol_ClientAuth_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_ClientAuth_descriptor, + new java.lang.String[] { "Username", "Password", "NetReadTimeout", "NetWriteTimeout", "Destination", "ClientId", "Filter", "StartTimestamp", "NetReadTimeoutPresent", "NetWriteTimeoutPresent", }); + internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_com_alibaba_otter_canal_protocol_Ack_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Ack_descriptor, + new java.lang.String[] { "ErrorCode", "ErrorMessage", "ErrorCodePresent", }); + internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_com_alibaba_otter_canal_protocol_ClientAck_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_ClientAck_descriptor, + new java.lang.String[] { "Destination", "ClientId", "BatchId", }); + internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_com_alibaba_otter_canal_protocol_Sub_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Sub_descriptor, + new java.lang.String[] { "Destination", "ClientId", "Filter", }); + internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_com_alibaba_otter_canal_protocol_Unsub_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Unsub_descriptor, + new java.lang.String[] { "Destination", "ClientId", "Filter", }); + internal_static_com_alibaba_otter_canal_protocol_Get_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_com_alibaba_otter_canal_protocol_Get_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Get_descriptor, + new java.lang.String[] { "Destination", "ClientId", "FetchSize", "Timeout", "Unit", "AutoAck", "TimeoutPresent", "UnitPresent", "AutoAckPresent", }); + internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_com_alibaba_otter_canal_protocol_Messages_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Messages_descriptor, + new java.lang.String[] { "BatchId", "Messages", }); + internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_com_alibaba_otter_canal_protocol_Dump_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_Dump_descriptor, + new java.lang.String[] { "Journal", "Position", "Timestamp", "TimestampPresent", }); + internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_com_alibaba_otter_canal_protocol_ClientRollback_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_alibaba_otter_canal_protocol_ClientRollback_descriptor, + new java.lang.String[] { "Destination", "ClientId", "BatchId", }); + } + + // @@protoc_insertion_point(outer_class_scope) } diff --git a/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalProtocol.proto b/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalProtocol.proto index 80f03439..e4e35b6d 100644 --- a/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalProtocol.proto +++ b/protocol/src/main/java/com/alibaba/otter/canal/protocol/CanalProtocol.proto @@ -1,3 +1,4 @@ +syntax = "proto3"; package com.alibaba.otter.canal.protocol; option java_package = "com.alibaba.otter.canal.protocol"; @@ -5,6 +6,7 @@ option java_outer_classname = "CanalPacket"; option optimize_for = SPEED; enum Compression { + COMPRESSIONCOMPATIBLEPROTO2 = 0; NONE = 1; ZLIB = 2; GZIP = 3; @@ -12,6 +14,8 @@ enum Compression { } enum PacketType { + //compatible + PACKAGETYPECOMPATIBLEPROTO2 = 0; HANDSHAKE = 1; CLIENTAUTHENTICATION = 2; ACK = 3; @@ -29,86 +33,122 @@ enum PacketType { } message Packet { - optional int32 magic_number = 1 [default = 17]; - optional int32 version = 2 [default = 1]; - optional PacketType type = 3; - optional Compression compression = 4 [default = NONE]; - optional bytes body = 5; + //[default = 17]; + oneof magic_number_present { + int32 magic_number = 1; + } + //[default = 1]; + oneof version_present { + int32 version = 2; + }; + PacketType type = 3; + //[default = NONE]; + oneof compression_present { + Compression compression = 4; + } + + bytes body = 5; } message HeartBeat { - optional int64 send_timestamp = 1; - optional int64 start_timestamp = 2; + int64 send_timestamp = 1; + int64 start_timestamp = 2; } message Handshake { - optional string communication_encoding = 1 [default = "utf8"]; - optional bytes seeds = 2; - repeated Compression supported_compressions = 3; + // [default = "utf8"]; + oneof communication_encoding_present { + string communication_encoding = 1; + } + bytes seeds = 2; + Compression supported_compressions = 3; } // client authentication message ClientAuth { - optional string username = 1; - optional bytes password = 2; // hashed password with seeds from Handshake message - optional int32 net_read_timeout = 3 [default = 0]; // in seconds - optional int32 net_write_timeout = 4 [default = 0]; // in seconds - optional string destination = 5; - optional string client_id = 6; - optional string filter = 7; - optional int64 start_timestamp = 8; + string username = 1; + bytes password = 2; // hashed password with seeds from Handshake message + // [default = 0] + oneof net_read_timeout_present { + int32 net_read_timeout = 3; // in seconds + } + // [default = 0]; + oneof net_write_timeout_present { + int32 net_write_timeout = 4; // in seconds + } + string destination = 5; + string client_id = 6; + string filter = 7; + int64 start_timestamp = 8; } message Ack { - optional int32 error_code = 1 [default = 0]; - optional string error_message = 2; // if something like compression is not supported, erorr_message will tell about it. + //[default = 0] + oneof error_code_present { + int32 error_code = 1; + } + string error_message = 2; // if something like compression is not supported, erorr_message will tell about it. } message ClientAck { - optional string destination = 1; - optional string client_id = 2; - optional int64 batch_id = 3; + string destination = 1; + string client_id = 2; + int64 batch_id = 3; } // subscription message Sub { - optional string destination = 1; - optional string client_id = 2; - optional string filter = 7; + string destination = 1; + string client_id = 2; + string filter = 7; } // Unsubscription message Unsub { - optional string destination = 1; - optional string client_id = 2; - optional string filter = 7; + string destination = 1; + string client_id = 2; + string filter = 7; } // PullRequest message Get { - optional string destination = 1; - optional string client_id = 2; - optional int32 fetch_size = 3; - optional int64 timeout = 4 [default = -1]; // 默认-1时代表不控制 - optional int32 unit = 5 [default = 2];// 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天 - optional bool auto_ack = 6 [default = false]; // 是否自动ack + string destination = 1; + string client_id = 2; + int32 fetch_size = 3; + //[default = -1] + oneof timeout_present { + int64 timeout = 4; // 默认-1时代表不控制 + } + //[default = 2] + oneof unit_present { + int32 unit = 5;// 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天 + } + //[default = false] + oneof auto_ack_present { + bool auto_ack = 6; // 是否自动ack + } + } // message Messages { - optional int64 batch_id = 1; + int64 batch_id = 1; repeated bytes messages = 2; } // TBD when new packets are required message Dump{ - optional string journal = 1; - optional int64 position = 2; - optional int64 timestamp = 3 [default = 0]; + string journal = 1; + int64 position = 2; + // [default = 0] + oneof timestamp_present { + int64 timestamp = 3; + } + } message ClientRollback{ - optional string destination = 1; - optional string client_id = 2; - optional int64 batch_id = 3; + string destination = 1; + string client_id = 2; + int64 batch_id = 3; } \ No newline at end of file diff --git a/protocol/src/main/java/com/alibaba/otter/canal/protocol/EntryProtocol.proto b/protocol/src/main/java/com/alibaba/otter/canal/protocol/EntryProtocol.proto index 526db41f..1330bbc7 100644 --- a/protocol/src/main/java/com/alibaba/otter/canal/protocol/EntryProtocol.proto +++ b/protocol/src/main/java/com/alibaba/otter/canal/protocol/EntryProtocol.proto @@ -1,3 +1,4 @@ +syntax = "proto3"; package com.alibaba.otter.canal.protocol; option java_package = "com.alibaba.otter.canal.protocol"; @@ -10,88 +11,101 @@ option optimize_for = SPEED; ****************************************************************/ message Entry { /**协议头部信息**/ - optional Header header = 1; - - /**打散后的事件类型**/ - optional EntryType entryType = 2 [default = ROWDATA]; - + Header header = 1; + ///**打散后的事件类型**/ [default = ROWDATA] + oneof entryType_present{ + EntryType entryType = 2; + } + /**传输的二进制数组**/ - optional bytes storeValue = 3; + bytes storeValue = 3; } /**message Header**/ message Header { - /**协议的版本号**/ - optional int32 version = 1 [default = 1]; - + /**协议的版本号**/ //[default = 1] + oneof version_present { + int32 version = 1; + } + + /**binlog/redolog 文件名**/ - optional string logfileName = 2; - + string logfileName = 2; + /**binlog/redolog 文件的偏移位置**/ - optional int64 logfileOffset = 3; - + int64 logfileOffset = 3; + /**服务端serverId**/ - optional int64 serverId = 4; - + int64 serverId = 4; + /** 变更数据的编码 **/ - optional string serverenCode = 5; - + string serverenCode = 5; + /**变更数据的执行时间 **/ - optional int64 executeTime = 6; - - /** 变更数据的来源**/ - optional Type sourceType = 7 [default = MYSQL]; - + int64 executeTime = 6; + + /** 变更数据的来源**/ //[default = MYSQL] + oneof sourceType_present { + Type sourceType = 7; + } + + /** 变更数据的schemaname**/ - optional string schemaName = 8; - + string schemaName = 8; + /**变更数据的tablename**/ - optional string tableName = 9; - + string tableName = 9; + /**每个event的长度**/ - optional int64 eventLength = 10; - - /**数据变更类型**/ - optional EventType eventType = 11 [default = UPDATE]; - + int64 eventLength = 10; + + /**数据变更类型**/ // [default = UPDATE] + oneof eventType_present { + EventType eventType = 11; + } + + /**预留扩展**/ repeated Pair props = 12; /**当前事务的gitd**/ - optional string gtid = 13; + string gtid = 13; } /**每个字段的数据结构**/ message Column { /**字段下标**/ - optional int32 index = 1; - + int32 index = 1; + /**字段java中类型**/ - optional int32 sqlType = 2; - + int32 sqlType = 2; + /**字段名称(忽略大小写),在mysql中是没有的**/ - optional string name = 3; - + string name = 3; + /**是否是主键**/ - optional bool isKey = 4; - + bool isKey = 4; + /**如果EventType=UPDATE,用于标识这个字段值是否有修改**/ - optional bool updated = 5; - - /** 标识是否为空 **/ - optional bool isNull = 6 [default = false]; - + bool updated = 5; + + /** 标识是否为空 **/ //[default = false] + oneof isNull_present { + bool isNull = 6; + } + + /**预留扩展**/ - repeated Pair props = 7; - + repeated Pair props = 7; + /** 字段值,timestamp,Datetime是一个时间格式的文本 **/ - optional string value = 8; - + string value = 8; + /** 对应数据对象原始长度 **/ - optional int32 length = 9; - + int32 length = 9; + /**字段mysql类型**/ - optional string mysqlType = 10; + string mysqlType = 10; } message RowData { @@ -101,73 +115,81 @@ message RowData { /** 字段信息,增量数据(修改后,新增后) **/ repeated Column afterColumns = 2; - + /**预留扩展**/ - repeated Pair props = 3; + repeated Pair props = 3; } /**message row 每行变更数据的数据结构**/ message RowChange { /**tableId,由数据库产生**/ - optional int64 tableId = 1; - - /**数据变更类型**/ - optional EventType eventType = 2 [default = UPDATE]; - - /** 标识是否是ddl语句 **/ - optional bool isDdl = 10 [default = false]; + int64 tableId = 1; + + + /**数据变更类型**/ //[default = UPDATE] + oneof eventType_present { + EventType eventType = 2; + } + + + /** 标识是否是ddl语句 **/ // [default = false] + oneof isDdl_present { + bool isDdl = 10; + } + /** ddl/query的sql语句 **/ - optional string sql = 11; - + string sql = 11; + /** 一次数据库变更可能存在多行 **/ repeated RowData rowDatas = 12; - + /**预留扩展**/ - repeated Pair props = 13; - + repeated Pair props = 13; + /** ddl/query的schemaName,会存在跨库ddl,需要保留执行ddl的当前schemaName **/ - optional string ddlSchemaName = 14; + string ddlSchemaName = 14; } /**开始事务的一些信息**/ message TransactionBegin{ - + /**已废弃,请使用header里的executeTime**/ - optional int64 executeTime = 1; - + int64 executeTime = 1; + /**已废弃,Begin里不提供事务id**/ - optional string transactionId = 2; - + string transactionId = 2; + /**预留扩展**/ - repeated Pair props = 3; - + repeated Pair props = 3; + /**执行的thread Id**/ - optional int64 threadId = 4; + int64 threadId = 4; } /**结束事务的一些信息**/ message TransactionEnd{ - + /**已废弃,请使用header里的executeTime**/ - optional int64 executeTime = 1; - + int64 executeTime = 1; + /**事务号**/ - optional string transactionId = 2; - + string transactionId = 2; + /**预留扩展**/ - repeated Pair props = 3; + repeated Pair props = 3; } /**预留扩展**/ message Pair{ - optional string key = 1; - optional string value = 2; + string key = 1; + string value = 2; } /**打散后的事件类型,主要用于标识事务的开始,变更数据,结束**/ enum EntryType{ + ENTRYTYPECOMPATIBLEPROTO2 = 0; TRANSACTIONBEGIN = 1; ROWDATA = 2; TRANSACTIONEND = 3; @@ -178,6 +200,7 @@ enum EntryType{ /** 事件类型 **/ enum EventType { + EVENTTYPECOMPATIBLEPROTO2 = 0; INSERT = 1; UPDATE = 2; DELETE = 3; @@ -200,6 +223,7 @@ enum EventType { /**数据库类型**/ enum Type { + TYPECOMPATIBLEPROTO2 = 0; ORACLE = 1; MYSQL = 2; PGSQL = 3; diff --git a/protocol/src/main/java/com/alibaba/otter/canal/protocol/FlatMessage.java b/protocol/src/main/java/com/alibaba/otter/canal/protocol/FlatMessage.java new file mode 100644 index 00000000..51bd320a --- /dev/null +++ b/protocol/src/main/java/com/alibaba/otter/canal/protocol/FlatMessage.java @@ -0,0 +1,304 @@ +package com.alibaba.otter.canal.protocol; + +import java.io.Serializable; +import java.util.*; + +import com.google.protobuf.ByteString; + +/** + * @author machengyuan 2018-9-13 下午10:31:14 + * @version 1.0.0 + */ +public class FlatMessage implements Serializable { + + private static final long serialVersionUID = -3386650678735860050L; + + private long id; + private String database; + private String table; + private Boolean isDdl; + private String type; + private Long ts; + private String sql; + private Map sqlType; + private Map mysqlType; + private List> data; + private List> old; + + public FlatMessage(){ + } + + public FlatMessage(long id){ + this.id = id; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getDatabase() { + return database; + } + + public void setDatabase(String database) { + this.database = database; + } + + public String getTable() { + return table; + } + + public void setTable(String table) { + this.table = table; + } + + public Boolean getIsDdl() { + return isDdl; + } + + public void setIsDdl(Boolean isDdl) { + this.isDdl = isDdl; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Long getTs() { + return ts; + } + + public void setTs(Long ts) { + this.ts = ts; + } + + public String getSql() { + return sql; + } + + public void setSql(String sql) { + this.sql = sql; + } + + public Map getSqlType() { + return sqlType; + } + + public void setSqlType(Map sqlType) { + this.sqlType = sqlType; + } + + public Map getMysqlType() { + return mysqlType; + } + + public void setMysqlType(Map mysqlType) { + this.mysqlType = mysqlType; + } + + public List> getData() { + return data; + } + + public void setData(List> data) { + this.data = data; + } + + public List> getOld() { + return old; + } + + public void setOld(List> old) { + this.old = old; + } + + /** + * 将Message转换为FlatMessage + * + * @param message 原生message + * @return FlatMessage列表 + */ + public static List messageConverter(Message message) { + try { + if (message == null) { + return null; + } + + List flatMessages = new ArrayList<>(); + + List rawEntries = message.getRawEntries(); + + for (ByteString byteString : rawEntries) { + CanalEntry.Entry entry = CanalEntry.Entry.parseFrom(byteString); + if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN + || entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) { + continue; + } + + CanalEntry.RowChange rowChange; + try { + rowChange = CanalEntry.RowChange.parseFrom(entry.getStoreValue()); + } catch (Exception e) { + throw new RuntimeException( + "ERROR ## parser of eromanga-event has an error , data:" + entry.toString(), + e); + } + + CanalEntry.EventType eventType = rowChange.getEventType(); + + FlatMessage flatMessage = new FlatMessage(message.getId()); + flatMessages.add(flatMessage); + flatMessage.setDatabase(entry.getHeader().getSchemaName()); + flatMessage.setTable(entry.getHeader().getTableName()); + flatMessage.setIsDdl(rowChange.getIsDdl()); + flatMessage.setType(eventType.toString()); + flatMessage.setTs(System.currentTimeMillis()); + flatMessage.setSql(rowChange.getSql()); + + if (!rowChange.getIsDdl()) { + Map sqlType = new LinkedHashMap<>(); + Map mysqlType = new LinkedHashMap<>(); + List> data = new ArrayList<>(); + List> old = new ArrayList<>(); + + Set updateSet = new HashSet<>(); + for (CanalEntry.RowData rowData : rowChange.getRowDatasList()) { + if (eventType != CanalEntry.EventType.INSERT && eventType != CanalEntry.EventType.UPDATE + && eventType != CanalEntry.EventType.DELETE) { + continue; + } + + Map row = new LinkedHashMap<>(); + List columns; + + if (eventType == CanalEntry.EventType.DELETE) { + columns = rowData.getBeforeColumnsList(); + } else { + columns = rowData.getAfterColumnsList(); + } + + for (CanalEntry.Column column : columns) { + sqlType.put(column.getName(), column.getSqlType()); + mysqlType.put(column.getName(), column.getMysqlType()); + row.put(column.getName(), column.getValue()); + // 获取update为true的字段 + if (column.getUpdated()) { + updateSet.add(column.getName()); + } + } + if (!row.isEmpty()) { + data.add(row); + } + + if (eventType == CanalEntry.EventType.UPDATE) { + Map rowOld = new LinkedHashMap<>(); + for (CanalEntry.Column column : rowData.getBeforeColumnsList()) { + if (updateSet.contains(column.getName())) { + rowOld.put(column.getName(), column.getValue()); + } + } + // update操作将记录修改前的值 + if (!rowOld.isEmpty()) { + old.add(rowOld); + } + } + } + if (!sqlType.isEmpty()) { + flatMessage.setSqlType(sqlType); + } + if (!mysqlType.isEmpty()) { + flatMessage.setMysqlType(mysqlType); + } + if (!data.isEmpty()) { + flatMessage.setData(data); + } + if (!old.isEmpty()) { + flatMessage.setOld(old); + } + } + } + return flatMessages; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 将FlatMessage按指定的字段值hash拆分 + * + * @param flatMessage flatMessage + * @param partitionsNum 分区数量 + * @param pkHashConfig hash映射 + * @return 拆分后的flatMessage数组 + */ + public static FlatMessage[] messagePartition(FlatMessage flatMessage, Integer partitionsNum, + Map pkHashConfig) { + if (partitionsNum == null) { + partitionsNum = 1; + } + FlatMessage[] partitionMessages = new FlatMessage[partitionsNum]; + + String pk = pkHashConfig.get(flatMessage.getDatabase() + "." + flatMessage.getTable()); + if (pk == null || flatMessage.getIsDdl()) { + partitionMessages[0] = flatMessage; + } else { + if (flatMessage.getData() != null) { + int idx = 0; + for (Map row : flatMessage.getData()) { + String value = row.get(pk); + if (value == null) { + value = ""; + } + int hash = value.hashCode(); + int pkHash = Math.abs(hash) % partitionsNum; + // math.abs可能返回负值,这里再取反,把出现负值的数据还是写到固定的分区,仍然可以保证消费顺序 + pkHash = Math.abs(pkHash); + + FlatMessage flatMessageTmp = partitionMessages[pkHash]; + if (flatMessageTmp == null) { + flatMessageTmp = new FlatMessage(flatMessage.getId()); + partitionMessages[pkHash] = flatMessageTmp; + flatMessageTmp.setDatabase(flatMessage.getDatabase()); + flatMessageTmp.setTable(flatMessage.getTable()); + flatMessageTmp.setIsDdl(flatMessage.getIsDdl()); + flatMessageTmp.setType(flatMessage.getType()); + flatMessageTmp.setSql(flatMessage.getSql()); + flatMessageTmp.setSqlType(flatMessage.getSqlType()); + flatMessageTmp.setMysqlType(flatMessage.getMysqlType()); + } + List> data = flatMessageTmp.getData(); + if (data == null) { + data = new ArrayList<>(); + flatMessageTmp.setData(data); + } + data.add(row); + if (flatMessage.getOld() != null && !flatMessage.getOld().isEmpty()) { + List> old = flatMessageTmp.getOld(); + if (old == null) { + old = new ArrayList<>(); + flatMessageTmp.setOld(old); + } + old.add(flatMessage.getOld().get(idx)); + } + idx++; + } + } + } + return partitionMessages; + } + + @Override + public String toString() { + return "FlatMessage{" + "id=" + id + ", database='" + database + '\'' + ", table='" + table + '\'' + ", isDdl=" + + isDdl + ", type='" + type + '\'' + ", ts=" + ts + ", sql='" + sql + '\'' + ", sqlType=" + sqlType + + ", mysqlType=" + mysqlType + ", data=" + data + ", old=" + old + '}'; + } +} diff --git a/server/src/main/java/com/alibaba/otter/canal/common/CanalMessageSerializer.java b/server/src/main/java/com/alibaba/otter/canal/common/CanalMessageSerializer.java index 55d350c6..a4b89bd9 100644 --- a/server/src/main/java/com/alibaba/otter/canal/common/CanalMessageSerializer.java +++ b/server/src/main/java/com/alibaba/otter/canal/common/CanalMessageSerializer.java @@ -2,6 +2,7 @@ package com.alibaba.otter.canal.common; import com.alibaba.otter.canal.protocol.CanalEntry; import com.alibaba.otter.canal.protocol.CanalPacket; +import com.alibaba.otter.canal.protocol.CanalPacket.PacketType; import com.alibaba.otter.canal.protocol.Message; import com.google.protobuf.ByteString; import com.google.protobuf.CodedOutputStream; @@ -31,14 +32,14 @@ public class CanalMessageSerializer { // packet size int size = 0; size += CodedOutputStream.computeEnumSize(3, - CanalPacket.PacketType.MESSAGES.getNumber()); + PacketType.MESSAGES.getNumber()); size += CodedOutputStream.computeTagSize(5) + CodedOutputStream.computeRawVarint32Size(messageSize) + messageSize; // build data byte[] body = new byte[size]; CodedOutputStream output = CodedOutputStream.newInstance(body); - output.writeEnum(3, CanalPacket.PacketType.MESSAGES.getNumber()); + output.writeEnum(3, PacketType.MESSAGES.getNumber()); output.writeTag(5, WireFormat.WIRETYPE_LENGTH_DELIMITED); output.writeRawVarint32(messageSize); @@ -56,7 +57,7 @@ public class CanalMessageSerializer { } CanalPacket.Packet.Builder packetBuilder = CanalPacket.Packet.newBuilder(); - packetBuilder.setType(CanalPacket.PacketType.MESSAGES); + packetBuilder.setType(PacketType.MESSAGES); packetBuilder.setBody(messageBuilder.build().toByteString()); return packetBuilder.build().toByteArray(); } diff --git a/server/src/main/java/com/alibaba/otter/canal/common/MQProperties.java b/server/src/main/java/com/alibaba/otter/canal/common/MQProperties.java index 823a506a..0302407a 100644 --- a/server/src/main/java/com/alibaba/otter/canal/common/MQProperties.java +++ b/server/src/main/java/com/alibaba/otter/canal/common/MQProperties.java @@ -1,9 +1,8 @@ package com.alibaba.otter.canal.common; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; +import java.util.Map; /** * kafka 配置项 @@ -13,23 +12,26 @@ import java.util.Set; */ public class MQProperties { - private String servers = "localhost:6667"; - private int retries = 0; - private int batchSize = 16384; - private int lingerMs = 1; - private long bufferMemory = 33554432L; - private boolean filterTransactionEntry = true; - private int canalBatchSize = 5; - private String producerGroup = "Canal-Producer"; + private String servers = "localhost:6667"; + private int retries = 0; + private int batchSize = 16384; + private int lingerMs = 1; + private long bufferMemory = 33554432L; + private boolean filterTransactionEntry = true; + private String producerGroup = "Canal-Producer"; + private int canalBatchSize = 50; + private Long canalGetTimeout; + private boolean flatMessage = true; - private List canalDestinations = new ArrayList(); + private List canalDestinations = new ArrayList(); public static class CanalDestination { - private String canalDestination; - private String topic; - private Integer partition; - private Set topics = new HashSet(); + private String canalDestination; + private String topic; + private Integer partition; + private Integer partitionsNum; + private Map partitionHash; public String getCanalDestination() { return canalDestination; @@ -55,54 +57,23 @@ public class MQProperties { this.partition = partition; } - public Set getTopics() { - return topics; + public Integer getPartitionsNum() { + return partitionsNum; } - public void setTopics(Set topics) { - this.topics = topics; + public void setPartitionsNum(Integer partitionsNum) { + this.partitionsNum = partitionsNum; + } + + public Map getPartitionHash() { + return partitionHash; + } + + public void setPartitionHash(Map partitionHash) { + this.partitionHash = partitionHash; } } - public static class Topic { - - private String topic; - private Integer partition; - - public String getTopic() { - return topic; - } - - public void setTopic(String topic) { - this.topic = topic; - } - - public Integer getPartition() { - return partition; - } - - public void setPartition(Integer partition) { - this.partition = partition; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Topic topic1 = (Topic) o; - - if (topic != null ? !topic.equals(topic1.topic) : topic1.topic != null) return false; - return partition != null ? partition.equals(topic1.partition) : topic1.partition == null; - } - - @Override - public int hashCode() { - int result = topic != null ? topic.hashCode() : 0; - result = 31 * result + (partition != null ? partition.hashCode() : 0); - return result; - } - } public String getServers() { return servers; @@ -152,6 +123,22 @@ public class MQProperties { this.canalBatchSize = canalBatchSize; } + public Long getCanalGetTimeout() { + return canalGetTimeout; + } + + public void setCanalGetTimeout(Long canalGetTimeout) { + this.canalGetTimeout = canalGetTimeout; + } + + public boolean getFlatMessage() { + return flatMessage; + } + + public void setFlatMessage(boolean flatMessage) { + this.flatMessage = flatMessage; + } + public List getCanalDestinations() { return canalDestinations; } diff --git a/server/src/main/java/com/alibaba/otter/canal/kafka/CanalKafkaProducer.java b/server/src/main/java/com/alibaba/otter/canal/kafka/CanalKafkaProducer.java index 91531f7d..fc62ad21 100644 --- a/server/src/main/java/com/alibaba/otter/canal/kafka/CanalKafkaProducer.java +++ b/server/src/main/java/com/alibaba/otter/canal/kafka/CanalKafkaProducer.java @@ -1,10 +1,12 @@ package com.alibaba.otter.canal.kafka; +import com.alibaba.fastjson.JSON; import com.alibaba.otter.canal.common.MQProperties; +import com.alibaba.otter.canal.protocol.FlatMessage; +import com.alibaba.otter.canal.protocol.Message; import com.alibaba.otter.canal.spi.CanalMQProducer; -import java.io.IOException; +import java.util.List; import java.util.Properties; - import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; @@ -12,8 +14,6 @@ import org.apache.kafka.common.serialization.StringSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.alibaba.otter.canal.protocol.Message; - /** * kafka producer 主操作类 * @@ -26,8 +26,13 @@ public class CanalKafkaProducer implements CanalMQProducer { private Producer producer; + private Producer producer2; // 用于扁平message的数据投递 + + private MQProperties kafkaProperties; + @Override public void init(MQProperties kafkaProperties) { + this.kafkaProperties = kafkaProperties; Properties properties = new Properties(); properties.put("bootstrap.servers", kafkaProperties.getServers()); properties.put("acks", "all"); @@ -36,15 +41,27 @@ public class CanalKafkaProducer implements CanalMQProducer { properties.put("linger.ms", kafkaProperties.getLingerMs()); properties.put("buffer.memory", kafkaProperties.getBufferMemory()); properties.put("key.serializer", StringSerializer.class.getName()); - properties.put("value.serializer", MessageSerializer.class.getName()); - producer = new KafkaProducer(properties); + if (!kafkaProperties.getFlatMessage()) { + properties.put("value.serializer", MessageSerializer.class.getName()); + producer = new KafkaProducer(properties); + } else { + properties.put("value.serializer", StringSerializer.class.getName()); + producer2 = new KafkaProducer(properties); + } + + // producer.initTransactions(); } @Override public void stop() { try { logger.info("## stop the kafka producer"); - producer.close(); + if (producer != null) { + producer.close(); + } + if (producer2 != null) { + producer2.close(); + } } catch (Throwable e) { logger.warn("##something goes wrong when stopping kafka producer:", e); } finally { @@ -53,16 +70,72 @@ public class CanalKafkaProducer implements CanalMQProducer { } @Override - public void send(MQProperties.Topic topic, Message message) throws IOException { - ProducerRecord record; - if (topic.getPartition() != null) { - record = new ProducerRecord(topic.getTopic(), topic.getPartition(), null, message); - } else { - record = new ProducerRecord(topic.getTopic(), message); - } - producer.send(record); - if (logger.isDebugEnabled()) { - logger.debug("send message to kafka topic: {} \n {}", topic.getTopic(), message.toString()); + public void send(MQProperties.CanalDestination canalDestination, Message message, Callback callback) { + try { + // producer.beginTransaction(); + if (!kafkaProperties.getFlatMessage()) { + ProducerRecord record; + if (canalDestination.getPartition() != null) { + record = new ProducerRecord(canalDestination.getTopic(), + canalDestination.getPartition(), + null, + message); + } else { + record = new ProducerRecord(canalDestination.getTopic(), 0, null, message); + } + + producer.send(record); + } else { + // 发送扁平数据json + List flatMessages = FlatMessage.messageConverter(message); + if (flatMessages != null) { + for (FlatMessage flatMessage : flatMessages) { + if (canalDestination.getPartition() != null) { + ProducerRecord record = new ProducerRecord(canalDestination + .getTopic(), canalDestination.getPartition(), null, JSON.toJSONString(flatMessage)); + producer2.send(record); + } else { + if (canalDestination.getPartitionHash() != null + && !canalDestination.getPartitionHash().isEmpty()) { + FlatMessage[] partitionFlatMessage = FlatMessage.messagePartition(flatMessage, + canalDestination.getPartitionsNum(), + canalDestination.getPartitionHash()); + int length = partitionFlatMessage.length; + for (int i = 0; i < length; i++) { + FlatMessage flatMessagePart = partitionFlatMessage[i]; + if (flatMessagePart != null) { + ProducerRecord record = new ProducerRecord( + canalDestination.getTopic(), + i, + null, + JSON.toJSONString(flatMessagePart)); + producer2.send(record); + } + } + } else { + ProducerRecord record = new ProducerRecord( + canalDestination.getTopic(), + 0, + null, + JSON.toJSONString(flatMessage)); + producer2.send(record); + } + } + + } + } + } + + // producer.commitTransaction(); + callback.commit(); + if (logger.isDebugEnabled()) { + logger.debug("send message to kafka topic: {}", canalDestination.getTopic()); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + // producer.abortTransaction(); + callback.rollback(); } } + } diff --git a/server/src/main/java/com/alibaba/otter/canal/kafka/MessageSerializer.java b/server/src/main/java/com/alibaba/otter/canal/kafka/MessageSerializer.java index 67dc04bc..59d2bc20 100644 --- a/server/src/main/java/com/alibaba/otter/canal/kafka/MessageSerializer.java +++ b/server/src/main/java/com/alibaba/otter/canal/kafka/MessageSerializer.java @@ -1,20 +1,9 @@ package com.alibaba.otter.canal.kafka; import com.alibaba.otter.canal.common.CanalMessageSerializer; -import java.util.List; -import java.util.Map; - -import org.apache.kafka.common.errors.SerializationException; -import org.apache.kafka.common.serialization.Serializer; -import org.springframework.util.CollectionUtils; - -import com.alibaba.otter.canal.protocol.CanalEntry; -import com.alibaba.otter.canal.protocol.CanalPacket; -import com.alibaba.otter.canal.protocol.CanalPacket.PacketType; import com.alibaba.otter.canal.protocol.Message; -import com.google.protobuf.ByteString; -import com.google.protobuf.CodedOutputStream; -import com.google.protobuf.WireFormat; +import java.util.Map; +import org.apache.kafka.common.serialization.Serializer; /** * Kafka Message类的序列化 diff --git a/server/src/main/java/com/alibaba/otter/canal/rocketmq/CanalRocketMQProducer.java b/server/src/main/java/com/alibaba/otter/canal/rocketmq/CanalRocketMQProducer.java index b7c57f2a..87011250 100644 --- a/server/src/main/java/com/alibaba/otter/canal/rocketmq/CanalRocketMQProducer.java +++ b/server/src/main/java/com/alibaba/otter/canal/rocketmq/CanalRocketMQProducer.java @@ -35,17 +35,24 @@ public class CanalRocketMQProducer implements CanalMQProducer { } @Override - public void send(final MQProperties.Topic topic, com.alibaba.otter.canal.protocol.Message data) { + public void send(final MQProperties.CanalDestination destination, com.alibaba.otter.canal.protocol.Message data, + Callback callback) { try { - Message message = new Message(topic.getTopic(), CanalMessageSerializer.serializer(data)); + Message message = new Message(destination.getTopic(), CanalMessageSerializer.serializer(data)); this.defaultMQProducer.send(message, new MessageQueueSelector() { @Override public MessageQueue select(List mqs, Message msg, Object arg) { - return mqs.get(topic.getPartition()); + int partition = 0; + if (destination.getPartition() != null) { + partition = destination.getPartition(); + } + return mqs.get(partition); } }, null); + callback.commit(); } catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) { logger.error("Send message error!", e); + callback.rollback(); } } diff --git a/server/src/main/java/com/alibaba/otter/canal/server/CanalMQStarter.java b/server/src/main/java/com/alibaba/otter/canal/server/CanalMQStarter.java index bd2fdac2..0510eec5 100644 --- a/server/src/main/java/com/alibaba/otter/canal/server/CanalMQStarter.java +++ b/server/src/main/java/com/alibaba/otter/canal/server/CanalMQStarter.java @@ -1,6 +1,7 @@ package com.alibaba.otter.canal.server; import com.alibaba.otter.canal.common.MQProperties; +import com.alibaba.otter.canal.kafka.CanalKafkaProducer; import com.alibaba.otter.canal.protocol.ClientIdentity; import com.alibaba.otter.canal.protocol.Message; import com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded; @@ -9,17 +10,18 @@ import java.io.FileInputStream; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; public class CanalMQStarter { - private static final Logger logger = LoggerFactory.getLogger(CanalMQStarter.class); + private static final Logger logger = LoggerFactory.getLogger(CanalMQStarter.class); private static final String CLASSPATH_URL_PREFIX = "classpath:"; - private volatile boolean running = false; + private volatile boolean running = false; private ExecutorService executorService; @@ -27,7 +29,7 @@ public class CanalMQStarter { private MQProperties properties; - public CanalMQStarter(CanalMQProducer canalMQProducer){ + public CanalMQStarter(CanalMQProducer canalMQProducer) { this.canalMQProducer = canalMQProducer; } @@ -51,6 +53,7 @@ public class CanalMQStarter { if (properties.isFilterTransactionEntry()) { System.setProperty("canal.instance.filter.transaction.entry", "true"); } + // 对应每个instance启动一个worker线程 List destinations = properties.getCanalDestinations(); @@ -95,8 +98,8 @@ public class CanalMQStarter { while (!running) ; logger.info("## start the canal consumer: {}.", destination.getCanalDestination()); - CanalServerWithEmbedded server = CanalServerWithEmbedded.instance(); - ClientIdentity clientIdentity = new ClientIdentity(destination.getCanalDestination(), (short) 1001, ""); + final CanalServerWithEmbedded server = CanalServerWithEmbedded.instance(); + final ClientIdentity clientIdentity = new ClientIdentity(destination.getCanalDestination(), (short) 1001, ""); while (running) { try { if (!server.getCanalInstances().containsKey(clientIdentity.getDestination())) { @@ -111,27 +114,41 @@ public class CanalMQStarter { logger.info("## the canal consumer {} is running now ......", destination.getCanalDestination()); while (running) { - Message message = server.getWithoutAck(clientIdentity, properties.getCanalBatchSize()); // 获取指定数量的数据 - long batchId = message.getId(); + Message message; + if (properties.getCanalGetTimeout() != null) { + message = server.getWithoutAck(clientIdentity, + properties.getCanalBatchSize(), + properties.getCanalGetTimeout(), + TimeUnit.MILLISECONDS); + } else { + message = server.getWithoutAck(clientIdentity, properties.getCanalBatchSize()); + } + + final long batchId = message.getId(); try { int size = message.isRaw() ? message.getRawEntries().size() : message.getEntries().size(); if (batchId != -1 && size != 0) { - if (!StringUtils.isEmpty(destination.getTopic())) { - MQProperties.Topic topic = new MQProperties.Topic(); - topic.setTopic(destination.getTopic()); - topic.setPartition(destination.getPartition()); - destination.getTopics().add(topic); - } - for (MQProperties.Topic topic : destination.getTopics()) { - canalMQProducer.send(topic, message); // 发送message到所有topic + canalMQProducer.send(destination, message, new CanalKafkaProducer.Callback() { + + @Override + public void commit() { + server.ack(clientIdentity, batchId); // 提交确认 + } + + @Override + public void rollback() { + server.rollback(clientIdentity, batchId); + } + }); // 发送message到topic + } else { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignore } } - if (batchId != -1) { - server.ack(clientIdentity, batchId); // 提交确认 - } } catch (Exception e) { - server.rollback(clientIdentity); logger.error(e.getMessage(), e); } } diff --git a/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java b/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java index 9ac5a834..a4f74c90 100644 --- a/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java +++ b/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java @@ -311,9 +311,10 @@ public class CanalServerWithEmbedded extends AbstractCanalLifeCycle implements C } if (CollectionUtils.isEmpty(events.getEvents())) { - logger.debug("getWithoutAck successfully, clientId:{} batchSize:{} but result is null", - clientIdentity.getClientId(), - batchSize); + // logger.debug("getWithoutAck successfully, clientId:{} batchSize:{} but result + // is null", + // clientIdentity.getClientId(), + // batchSize); return new Message(-1, true, new ArrayList()); // 返回空包,避免生成batchId,浪费性能 } else { // 记录到流式信息 diff --git a/server/src/main/java/com/alibaba/otter/canal/server/netty/handler/SessionHandler.java b/server/src/main/java/com/alibaba/otter/canal/server/netty/handler/SessionHandler.java index fe8c5538..d060c026 100644 --- a/server/src/main/java/com/alibaba/otter/canal/server/netty/handler/SessionHandler.java +++ b/server/src/main/java/com/alibaba/otter/canal/server/netty/handler/SessionHandler.java @@ -3,7 +3,6 @@ package com.alibaba.otter.canal.server.netty.handler; import java.util.List; import java.util.concurrent.TimeUnit; -import com.alibaba.otter.canal.server.netty.listener.ChannelFutureAggregator; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.jboss.netty.buffer.ChannelBuffer; @@ -34,6 +33,7 @@ import com.alibaba.otter.canal.protocol.ClientIdentity; import com.alibaba.otter.canal.protocol.Message; import com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded; import com.alibaba.otter.canal.server.netty.NettyUtils; +import com.alibaba.otter.canal.server.netty.listener.ChannelFutureAggregator; import com.google.protobuf.ByteString; import com.google.protobuf.CodedOutputStream; import com.google.protobuf.WireFormat; @@ -50,6 +50,7 @@ public class SessionHandler extends SimpleChannelHandler { this.embeddedServer = embeddedServer; } + @SuppressWarnings("deprecation") public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { logger.info("message receives in session handler..."); long start = System.nanoTime(); diff --git a/server/src/main/java/com/alibaba/otter/canal/server/netty/listener/ChannelFutureAggregator.java b/server/src/main/java/com/alibaba/otter/canal/server/netty/listener/ChannelFutureAggregator.java index 923001d1..e4793640 100644 --- a/server/src/main/java/com/alibaba/otter/canal/server/netty/listener/ChannelFutureAggregator.java +++ b/server/src/main/java/com/alibaba/otter/canal/server/netty/listener/ChannelFutureAggregator.java @@ -2,7 +2,7 @@ package com.alibaba.otter.canal.server.netty.listener; import com.alibaba.otter.canal.protocol.CanalPacket; import com.google.common.base.Preconditions; -import com.google.protobuf.GeneratedMessage; +import com.google.protobuf.GeneratedMessageV3; import org.jboss.netty.channel.ChannelFuture; import org.jboss.netty.channel.ChannelFutureListener; @@ -16,19 +16,19 @@ public class ChannelFutureAggregator implements ChannelFutureListener { private ClientRequestResult result; - public ChannelFutureAggregator(String destination, GeneratedMessage request, CanalPacket.PacketType type, int amount, long latency, boolean empty) { + public ChannelFutureAggregator(String destination, GeneratedMessageV3 request, CanalPacket.PacketType type, int amount, long latency, boolean empty) { this(destination, request, type, amount, latency, empty, (short) 0); } - public ChannelFutureAggregator(String destination, GeneratedMessage request, CanalPacket.PacketType type, int amount, long latency) { + public ChannelFutureAggregator(String destination, GeneratedMessageV3 request, CanalPacket.PacketType type, int amount, long latency) { this(destination, request, type, amount, latency, false, (short) 0); } - public ChannelFutureAggregator(String destination, GeneratedMessage request, CanalPacket.PacketType type, int amount, long latency, short errorCode) { + public ChannelFutureAggregator(String destination, GeneratedMessageV3 request, CanalPacket.PacketType type, int amount, long latency, short errorCode) { this(destination, request, type, amount, latency, false, errorCode); } - private ChannelFutureAggregator(String destination, GeneratedMessage request, CanalPacket.PacketType type, int amount, long latency, boolean empty, short errorCode) { + private ChannelFutureAggregator(String destination, GeneratedMessageV3 request, CanalPacket.PacketType type, int amount, long latency, boolean empty, short errorCode) { this.result = new ClientRequestResult.Builder() .destination(destination) .type(type) @@ -56,7 +56,7 @@ public class ChannelFutureAggregator implements ChannelFutureListener { private String destination; private CanalPacket.PacketType type; - private GeneratedMessage request; + private GeneratedMessageV3 request; private int amount; private long latency; private short errorCode; @@ -81,7 +81,7 @@ public class ChannelFutureAggregator implements ChannelFutureListener { private String destination; private CanalPacket.PacketType type; - private GeneratedMessage request; + private GeneratedMessageV3 request; private int amount; private long latency; private short errorCode; @@ -98,7 +98,7 @@ public class ChannelFutureAggregator implements ChannelFutureListener { return this; } - Builder request(GeneratedMessage request) { + Builder request(GeneratedMessageV3 request) { this.request = request; return this; } @@ -153,7 +153,7 @@ public class ChannelFutureAggregator implements ChannelFutureListener { return type; } - public GeneratedMessage getRequest() { + public GeneratedMessageV3 getRequest() { return request; } diff --git a/server/src/main/java/com/alibaba/otter/canal/spi/CanalMQProducer.java b/server/src/main/java/com/alibaba/otter/canal/spi/CanalMQProducer.java index b0edaf5b..895514c4 100644 --- a/server/src/main/java/com/alibaba/otter/canal/spi/CanalMQProducer.java +++ b/server/src/main/java/com/alibaba/otter/canal/spi/CanalMQProducer.java @@ -1,6 +1,7 @@ package com.alibaba.otter.canal.spi; import com.alibaba.otter.canal.common.MQProperties; +import com.alibaba.otter.canal.kafka.CanalKafkaProducer; import com.alibaba.otter.canal.protocol.Message; import java.io.IOException; @@ -15,14 +16,21 @@ public interface CanalMQProducer { /** * Send canal message to related topic * - * @param topic MQ topic + * @param canalDestination canal mq destination * @param message canal message * @throws IOException */ - void send(MQProperties.Topic topic, Message message) throws IOException; + void send(MQProperties.CanalDestination canalDestination, Message message, Callback callback) throws IOException; /** * Stop MQ producer service */ void stop(); + + interface Callback { + + void commit(); + + void rollback(); + } } \ No newline at end of file diff --git a/server/src/test/java/com/alibaba/otter/canal/server/CanalServerWithNettyTest.java b/server/src/test/java/com/alibaba/otter/canal/server/CanalServerWithNettyTest.java index 3b3c0ee0..673918fe 100644 --- a/server/src/test/java/com/alibaba/otter/canal/server/CanalServerWithNettyTest.java +++ b/server/src/test/java/com/alibaba/otter/canal/server/CanalServerWithNettyTest.java @@ -66,6 +66,8 @@ public class CanalServerWithNettyTest { @Test public void testAuth() { + + try { SocketChannel channel = SocketChannel.open(); channel.connect(new InetSocketAddress("127.0.0.1", 1088)); @@ -80,7 +82,7 @@ public class CanalServerWithNettyTest { } // Handshake handshake = Handshake.parseFrom(p.getBody()); - System.out.println(handshake.getSupportedCompressionsList()); + System.out.println(handshake.getSupportedCompressions()); // ClientAuth ca = ClientAuth.newBuilder() .setUsername("") diff --git a/sink/src/main/java/com/alibaba/otter/canal/sink/entry/EntryEventSink.java b/sink/src/main/java/com/alibaba/otter/canal/sink/entry/EntryEventSink.java index 7afde6b6..76124ec4 100644 --- a/sink/src/main/java/com/alibaba/otter/canal/sink/entry/EntryEventSink.java +++ b/sink/src/main/java/com/alibaba/otter/canal/sink/entry/EntryEventSink.java @@ -33,10 +33,13 @@ public class EntryEventSink extends AbstractCanalEventSink eventStore; - protected boolean filterTransactionEntry = false; // 是否需要过滤事务头/尾 + protected boolean filterTransactionEntry = false; // 是否需要尽可能过滤事务头/尾 protected boolean filterEmtryTransactionEntry = true; // 是否需要过滤空的事务头/尾 protected long emptyTransactionInterval = 5 * 1000; // 空的事务输出的频率 - protected long emptyTransctionThresold = 8192; // 超过1024个事务头,输出一个 + protected long emptyTransctionThresold = 8192; // 超过8192个事务头,输出一个 + + protected volatile long lastTransactionTimestamp = 0L; + protected AtomicLong lastTransactionCount = new AtomicLong(0L); protected volatile long lastEmptyTransactionTimestamp = 0L; protected AtomicLong lastEmptyTransactionCount = new AtomicLong(0L); private AtomicLong eventsSinkBlockingTime = new AtomicLong(0L); @@ -74,17 +77,7 @@ public class EntryEventSink extends AbstractCanalEventSink entrys, InetSocketAddress remoteAddress, String destination) throws CanalSinkException, InterruptedException { - List rowDatas = entrys; - if (filterTransactionEntry) { - rowDatas = new ArrayList(); - for (CanalEntry.Entry entry : entrys) { - if (entry.getEntryType() == EntryType.ROWDATA) { - rowDatas.add(entry); - } - } - } - - return sinkData(rowDatas, remoteAddress); + return sinkData(entrys, remoteAddress); } private boolean sinkData(List entrys, InetSocketAddress remoteAddress) @@ -97,17 +90,26 @@ public class EntryEventSink extends AbstractCanalEventSink emptyTransactionInterval + || lastTransactionCount.incrementAndGet() > emptyTransctionThresold) { + lastTransactionCount.set(0L); + lastTransactionTimestamp = currentTimestamp; + continue; + } + } + hasRowData |= (entry.getEntryType() == EntryType.ROWDATA); hasHeartBeat |= (entry.getEntryType() == EntryType.HEARTBEAT); + Event event = new Event(new LogIdentity(remoteAddress, -1L), entry); + events.add(event); } - if (hasRowData) { - // 存在row记录 - return doSink(events); - } else if (hasHeartBeat) { - // 存在heartbeat记录,直接跳给后续处理 + if (hasRowData || hasHeartBeat) { + // 存在row记录 或者 存在heartbeat记录,直接跳给后续处理 return doSink(events); } else { // 需要过滤的数据 diff --git a/store/src/main/java/com/alibaba/otter/canal/store/memory/MemoryEventStoreWithBuffer.java b/store/src/main/java/com/alibaba/otter/canal/store/memory/MemoryEventStoreWithBuffer.java index fb74d5f8..5fdb0323 100644 --- a/store/src/main/java/com/alibaba/otter/canal/store/memory/MemoryEventStoreWithBuffer.java +++ b/store/src/main/java/com/alibaba/otter/canal/store/memory/MemoryEventStoreWithBuffer.java @@ -35,16 +35,16 @@ import com.alibaba.otter.canal.store.model.Events; */ public class MemoryEventStoreWithBuffer extends AbstractCanalStoreScavenge implements CanalEventStore, CanalStoreScavenge { - private static final long INIT_SQEUENCE = -1; + private static final long INIT_SEQUENCE = -1; private int bufferSize = 16 * 1024; private int bufferMemUnit = 1024; // memsize的单位,默认为1kb大小 private int indexMask; private Event[] entries; // 记录下put/get/ack操作的三个下标 - private AtomicLong putSequence = new AtomicLong(INIT_SQEUENCE); // 代表当前put操作最后一次写操作发生的位置 - private AtomicLong getSequence = new AtomicLong(INIT_SQEUENCE); // 代表当前get操作读取的最后一条的位置 - private AtomicLong ackSequence = new AtomicLong(INIT_SQEUENCE); // 代表当前ack操作的最后一条的位置 + private AtomicLong putSequence = new AtomicLong(INIT_SEQUENCE); // 代表当前put操作最后一次写操作发生的位置 + private AtomicLong getSequence = new AtomicLong(INIT_SEQUENCE); // 代表当前get操作读取的最后一条的位置 + private AtomicLong ackSequence = new AtomicLong(INIT_SEQUENCE); // 代表当前ack操作的最后一条的位置 // 记录下put/get/ack操作的三个memsize大小 private AtomicLong putMemSize = new AtomicLong(0); @@ -358,17 +358,17 @@ public class MemoryEventStoreWithBuffer extends AbstractCanalStoreScavenge imple lock.lock(); try { long firstSeqeuence = ackSequence.get(); - if (firstSeqeuence == INIT_SQEUENCE && firstSeqeuence < putSequence.get()) { + if (firstSeqeuence == INIT_SEQUENCE && firstSeqeuence < putSequence.get()) { // 没有ack过数据 Event event = entries[getIndex(firstSeqeuence + 1)]; // 最后一次ack为-1,需要移动到下一条,included // = false return CanalEventUtils.createPosition(event, false); - } else if (firstSeqeuence > INIT_SQEUENCE && firstSeqeuence < putSequence.get()) { + } else if (firstSeqeuence > INIT_SEQUENCE && firstSeqeuence < putSequence.get()) { // ack未追上put操作 Event event = entries[getIndex(firstSeqeuence + 1)]; // 最后一次ack的位置数据 // + 1 return CanalEventUtils.createPosition(event, true); - } else if (firstSeqeuence > INIT_SQEUENCE && firstSeqeuence == putSequence.get()) { + } else if (firstSeqeuence > INIT_SEQUENCE && firstSeqeuence == putSequence.get()) { // 已经追上,store中没有数据 Event event = entries[getIndex(firstSeqeuence)]; // 最后一次ack的位置数据,和last为同一条,included // = false @@ -387,10 +387,10 @@ public class MemoryEventStoreWithBuffer extends AbstractCanalStoreScavenge imple lock.lock(); try { long latestSequence = putSequence.get(); - if (latestSequence > INIT_SQEUENCE && latestSequence != ackSequence.get()) { + if (latestSequence > INIT_SEQUENCE && latestSequence != ackSequence.get()) { Event event = entries[(int) putSequence.get() & indexMask]; // 最后一次写入的数据,最后一条未消费的数据 return CanalEventUtils.createPosition(event, true); - } else if (latestSequence > INIT_SQEUENCE && latestSequence == ackSequence.get()) { + } else if (latestSequence > INIT_SEQUENCE && latestSequence == ackSequence.get()) { // ack已经追上了put操作 Event event = entries[(int) putSequence.get() & indexMask]; // 最后一次写入的数据,included // = @@ -435,7 +435,7 @@ public class MemoryEventStoreWithBuffer extends AbstractCanalStoreScavenge imple if (batchMode.isMemSize()) { ackMemSize.addAndGet(memsize); // 尝试清空buffer中的内存,将ack之前的内存全部释放掉 - for (long index = sequence + 1; index <= next; index++) { + for (long index = sequence + 1; index < next; index++) { entries[getIndex(index)] = null;// 设置为null } } @@ -473,9 +473,9 @@ public class MemoryEventStoreWithBuffer extends AbstractCanalStoreScavenge imple final ReentrantLock lock = this.lock; lock.lock(); try { - putSequence.set(INIT_SQEUENCE); - getSequence.set(INIT_SQEUENCE); - ackSequence.set(INIT_SQEUENCE); + putSequence.set(INIT_SEQUENCE); + getSequence.set(INIT_SEQUENCE); + ackSequence.set(INIT_SEQUENCE); putMemSize.set(0); getMemSize.set(0);