Search in sources :

Example 1 with BinlogPosition

use of org.apache.rocketmq.mysql.position.BinlogPosition in project rocketmq-externals by apache.

the class EventProcessor method checkConnection.

private void checkConnection() throws Exception {
    if (!binaryLogClient.isConnected()) {
        BinlogPosition binlogPosition = replicator.getNextBinlogPosition();
        if (binlogPosition != null) {
            binaryLogClient.setBinlogFilename(binlogPosition.getBinlogFilename());
            binaryLogClient.setBinlogPosition(binlogPosition.getPosition());
        }
        binaryLogClient.connect(3000);
    }
}
Also used : BinlogPosition(org.apache.rocketmq.mysql.position.BinlogPosition)

Example 2 with BinlogPosition

use of org.apache.rocketmq.mysql.position.BinlogPosition in project rocketmq-externals by apache.

the class EventProcessor method processXidEvent.

private void processXidEvent(Event event) {
    EventHeaderV4 header = event.getHeader();
    XidEventData data = event.getData();
    String binlogFilename = binaryLogClient.getBinlogFilename();
    Long position = header.getNextPosition();
    Long xid = data.getXid();
    BinlogPosition binlogPosition = new BinlogPosition(binlogFilename, position);
    transaction.setNextBinlogPosition(binlogPosition);
    transaction.setXid(xid);
    replicator.commit(transaction, true);
    transaction = new Transaction(config);
}
Also used : XidEventData(com.github.shyiko.mysql.binlog.event.XidEventData) EventHeaderV4(com.github.shyiko.mysql.binlog.event.EventHeaderV4) BinlogPosition(org.apache.rocketmq.mysql.position.BinlogPosition)

Aggregations

BinlogPosition (org.apache.rocketmq.mysql.position.BinlogPosition)2 EventHeaderV4 (com.github.shyiko.mysql.binlog.event.EventHeaderV4)1 XidEventData (com.github.shyiko.mysql.binlog.event.XidEventData)1