com.alibaba.otter.canal.protocol.CanalEntry.Pair Java Examples
The following examples show how to use
com.alibaba.otter.canal.protocol.CanalEntry.Pair.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseCanalClientTest.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
protected void printXAInfo(List<Pair> pairs) { if (pairs == null) { return; } String xaType = null; String xaXid = null; for (Pair pair : pairs) { String key = pair.getKey(); if (StringUtils.endsWithIgnoreCase(key, "XA_TYPE")) { xaType = pair.getValue(); } else if (StringUtils.endsWithIgnoreCase(key, "XA_XID")) { xaXid = pair.getValue(); } } if (xaType != null && xaXid != null) { logger.info(" ------> " + xaType + " " + xaXid); } }
Example #2
Source File: MysqlDumpTest.java From canal with Apache License 2.0 | 6 votes |
private void printXAInfo(List<Pair> pairs) { if (pairs == null) { return; } String xaType = null; String xaXid = null; for (Pair pair : pairs) { String key = pair.getKey(); if (StringUtils.endsWithIgnoreCase(key, "XA_TYPE")) { xaType = pair.getValue(); } else if (StringUtils.endsWithIgnoreCase(key, "XA_XID")) { xaXid = pair.getValue(); } } if (xaType != null && xaXid != null) { System.out.println(" ------> " + xaType + " " + xaXid); } }
Example #3
Source File: LogEventConvert.java From canal with Apache License 2.0 | 6 votes |
private Entry parseGTIDLogEvent(GtidLogEvent logEvent) { LogHeader logHeader = logEvent.getHeader(); Pair.Builder builder = Pair.newBuilder(); builder.setKey("gtid"); builder.setValue(logEvent.getGtidStr()); if (logEvent.getLastCommitted() != null) { builder.setKey("lastCommitted"); builder.setValue(String.valueOf(logEvent.getLastCommitted())); builder.setKey("sequenceNumber"); builder.setValue(String.valueOf(logEvent.getSequenceNumber())); } Header header = createHeader(logHeader, "", "", EventType.GTID); return createEntry(header, EntryType.GTIDLOG, builder.build().toByteString()); }
Example #4
Source File: LogEventConvert.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
private Entry parseGTIDLogEvent(GtidLogEvent logEvent) { LogHeader logHeader = logEvent.getHeader(); Pair.Builder builder = Pair.newBuilder(); builder.setKey("gtid"); builder.setValue(logEvent.getGtidStr()); if (logEvent.getLastCommitted() != null) { builder.setKey("lastCommitted"); builder.setValue(String.valueOf(logEvent.getLastCommitted())); builder.setKey("sequenceNumber"); builder.setValue(String.valueOf(logEvent.getSequenceNumber())); } Header header = createHeader(logHeader, "", "", EventType.GTID); return createEntry(header, EntryType.GTIDLOG, builder.build().toByteString()); }
Example #5
Source File: MysqlDumpTest.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
private void printXAInfo(List<Pair> pairs) { if (pairs == null) { return; } String xaType = null; String xaXid = null; for (Pair pair : pairs) { String key = pair.getKey(); if (StringUtils.endsWithIgnoreCase(key, "XA_TYPE")) { xaType = pair.getValue(); } else if (StringUtils.endsWithIgnoreCase(key, "XA_XID")) { xaXid = pair.getValue(); } } if (xaType != null && xaXid != null) { System.out.println(" ------> " + xaType + " " + xaXid); } }
Example #6
Source File: BaseCanalClientTest.java From canal with Apache License 2.0 | 6 votes |
protected void printXAInfo(List<Pair> pairs) { if (pairs == null) { return; } String xaType = null; String xaXid = null; for (Pair pair : pairs) { String key = pair.getKey(); if (StringUtils.endsWithIgnoreCase(key, "XA_TYPE")) { xaType = pair.getValue(); } else if (StringUtils.endsWithIgnoreCase(key, "XA_XID")) { xaXid = pair.getValue(); } } if (xaType != null && xaXid != null) { logger.info(" ------> " + xaType + " " + xaXid); } }
Example #7
Source File: BaseCanalClientTest.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
/** * 获取当前Entry的 GTID信息示例 * * @param header * @return */ public static String getCurrentGtid(CanalEntry.Header header) { List<CanalEntry.Pair> props = header.getPropsList(); if (props != null && props.size() > 0) { for (CanalEntry.Pair pair : props) { if ("curtGtid".equals(pair.getKey())) { return pair.getValue(); } } } return ""; }
Example #8
Source File: BaseCanalClientTest.java From canal with Apache License 2.0 | 5 votes |
/** * 获取当前Entry的 GTID Last Committed信息示例 * * @param header * @return */ public static String getCurrentGtidLct(CanalEntry.Header header) { List<CanalEntry.Pair> props = header.getPropsList(); if (props != null && props.size() > 0) { for (CanalEntry.Pair pair : props) { if ("curtGtidLct".equals(pair.getKey())) { return pair.getValue(); } } } return ""; }
Example #9
Source File: BaseCanalClientTest.java From canal with Apache License 2.0 | 5 votes |
/** * 获取当前Entry的 GTID Sequence No信息示例 * * @param header * @return */ public static String getCurrentGtidSn(CanalEntry.Header header) { List<CanalEntry.Pair> props = header.getPropsList(); if (props != null && props.size() > 0) { for (CanalEntry.Pair pair : props) { if ("curtGtidSn".equals(pair.getKey())) { return pair.getValue(); } } } return ""; }
Example #10
Source File: BaseCanalClientTest.java From canal with Apache License 2.0 | 5 votes |
/** * 获取当前Entry的 GTID信息示例 * * @param header * @return */ public static String getCurrentGtid(CanalEntry.Header header) { List<CanalEntry.Pair> props = header.getPropsList(); if (props != null && props.size() > 0) { for (CanalEntry.Pair pair : props) { if ("curtGtid".equals(pair.getKey())) { return pair.getValue(); } } } return ""; }
Example #11
Source File: BaseCanalClientTest.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
/** * 获取当前Entry的 GTID Last Committed信息示例 * * @param header * @return */ public static String getCurrentGtidLct(CanalEntry.Header header) { List<CanalEntry.Pair> props = header.getPropsList(); if (props != null && props.size() > 0) { for (CanalEntry.Pair pair : props) { if ("curtGtidLct".equals(pair.getKey())) { return pair.getValue(); } } } return ""; }
Example #12
Source File: BaseCanalClientTest.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
/** * 获取当前Entry的 GTID Sequence No信息示例 * * @param header * @return */ public static String getCurrentGtidSn(CanalEntry.Header header) { List<CanalEntry.Pair> props = header.getPropsList(); if (props != null && props.size() > 0) { for (CanalEntry.Pair pair : props) { if ("curtGtidSn".equals(pair.getKey())) { return pair.getValue(); } } } return ""; }
Example #13
Source File: LogEventConvert.java From DBus with Apache License 2.0 | 4 votes |
public static Pair createSpecialPair(String key, String value) { Pair.Builder pairBuilder = Pair.newBuilder(); pairBuilder.setKey(key); pairBuilder.setValue(value); return pairBuilder.build(); }
Example #14
Source File: LogEventConvert_old.java From DBus with Apache License 2.0 | 4 votes |
public static Pair createSpecialPair(String key, String value) { Pair.Builder pairBuilder = Pair.newBuilder(); pairBuilder.setKey(key); pairBuilder.setValue(value); return pairBuilder.build(); }
Example #15
Source File: LogEventConvert.java From DBus with Apache License 2.0 | 4 votes |
public static Pair createSpecialPair(String key, String value) { Pair.Builder pairBuilder = Pair.newBuilder(); pairBuilder.setKey(key); pairBuilder.setValue(value); return pairBuilder.build(); }
Example #16
Source File: LogEventConvert.java From canal-1.1.3 with Apache License 2.0 | 4 votes |
public static Pair createSpecialPair(String key, String value) { Pair.Builder pairBuilder = Pair.newBuilder(); pairBuilder.setKey(key); pairBuilder.setValue(value); return pairBuilder.build(); }
Example #17
Source File: LogEventConvert.java From canal with Apache License 2.0 | 4 votes |
public static Pair createSpecialPair(String key, String value) { Pair.Builder pairBuilder = Pair.newBuilder(); pairBuilder.setKey(key); pairBuilder.setValue(value); return pairBuilder.build(); }