public BinlogDumpCommandPacket build(String binglogFile, long position, long slaveId) { BinlogDumpCommandPacket command = new BinlogDumpCommandPacket(); command.binlogPosition = position; if (!StringUtils.isEmpty(binglogFile)) { command.binlogFileName = binglogFile; } command.slaveServerId = slaveId; // end settings. return command; }
public ChannelBuffer toChannelBuffer(BinlogDumpCommandPacket command) throws IOException { byte[] commandBytes = command.toBytes(); byte[] headerBytes = assembleHeaderBytes(commandBytes.length); ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(headerBytes, commandBytes); return buffer; }
ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(getCommand());
private void sendBinlogDump(String binlogfilename, Long binlogPosition) throws IOException { BinlogDumpCommandPacket binlogDumpCmd = new BinlogDumpCommandPacket(); binlogDumpCmd.binlogFileName = binlogfilename; binlogDumpCmd.binlogPosition = binlogPosition; binlogDumpCmd.slaveServerId = this.slaveId; byte[] cmdBody = binlogDumpCmd.toBytes(); logger.info("COM_BINLOG_DUMP with position:{}", binlogDumpCmd); HeaderPacket binlogDumpHeader = new HeaderPacket(); binlogDumpHeader.setPacketBodyLength(cmdBody.length); binlogDumpHeader.setPacketSequenceNumber((byte) 0x00); PacketManager.writePkg(connector.getChannel(), binlogDumpHeader.toBytes(), cmdBody); connector.setDumping(true); }
public BinlogDumpCommandPacket(){ setCommand((byte) 0x12); }
public BinlogDumpCommandPacket(){ setCommand((byte) 0x12); }
public ChannelBuffer toChannelBuffer(BinlogDumpCommandPacket command) throws IOException { byte[] commandBytes = command.toBytes(); byte[] headerBytes = assembleHeaderBytes(commandBytes.length); ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(headerBytes, commandBytes); return buffer; }
public BinlogDumpCommandPacket build(String binglogFile, long position, long slaveId) { BinlogDumpCommandPacket command = new BinlogDumpCommandPacket(); command.binlogPosition = position; if (!StringUtils.isEmpty(binglogFile)) { command.binlogFileName = binglogFile; } command.slaveServerId = slaveId; // end settings. return command; }
ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(getCommand());