Java Code Examples for com.github.shyiko.mysql.binlog.event.deserialization.json.JsonBinary

The following examples show how to use com.github.shyiko.mysql.binlog.event.deserialization.json.JsonBinary. These examples are extracted from open source projects. 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
@Override
public PublishedEvent parseEventData(WriteRowsEventData eventData, String binlogFilename, long position) throws IOException {
  if (columnOrders.isEmpty()) {
    try {
      getColumnOrders();
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }

  String eventDataValue;
  if(getValue(eventData, EVENT_DATA_FIELDNAME) instanceof String) {
    eventDataValue = (String) getValue(eventData, EVENT_DATA_FIELDNAME);
  } else {
    eventDataValue = JsonBinary.parseAsString((byte[])getValue(eventData, EVENT_DATA_FIELDNAME));
  }
  return new PublishedEvent(
          (String)getValue(eventData, EVENT_ID_FIELDNAME),
          (String)getValue(eventData, ENTITY_ID_FIELDNAME),
          (String)getValue(eventData, ENTITY_TYPE_FIELDNAME),
          eventDataValue,
          (String)getValue(eventData, EVENT_TYPE_FIELDNAME),
          new BinlogFileOffset(binlogFilename, position),
          Optional.ofNullable((String)getValue(eventData, EVENT_METADATA_FIELDNAME))
  );
}