Java Code Examples for com.github.shyiko.mysql.binlog.event.EventHeaderV4#getPosition()

The following examples show how to use com.github.shyiko.mysql.binlog.event.EventHeaderV4#getPosition() . 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: BinaryLogConnectorSource.java    From SpinalTap with Apache License 2.0 6 votes vote down vote up
public void onEvent(Event event) {
  Preconditions.checkState(isStarted(), "Source is not started and should not process events");

  final EventHeaderV4 header = event.getHeader();
  final BinlogFilePos filePos =
      new BinlogFilePos(
          binlogClient.getBinlogFilename(),
          header.getPosition(),
          header.getNextPosition(),
          binlogClient.getGtidSet(),
          serverUUID);

  BinaryLogConnectorEventMapper.INSTANCE
      .map(event, filePos)
      .ifPresent(BinaryLogConnectorSource.super::processEvent);
}
 
Example 2
Source File: DataId.java    From syncer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * <a href="https://github.com/shyiko/mysql-binlog-connector-java/issues/200">binlog table
 * map</a>
 */
static BinlogDataId fromEvent(Event[] event, String binlogFileName) {
  EventHeaderV4 tableMap = event[0].getHeader();
  EventHeaderV4 second = event[1].getHeader();
  // have to remember table map event for restart
  // have to add data event position for unique id:
  // because one table map event may follow multiple data event
  return new BinlogDataId(binlogFileName, tableMap.getPosition(), second.getPosition());
}