com.github.shyiko.mysql.binlog.event.deserialization.json.JsonBinary Java Examples
The following examples show how to use
com.github.shyiko.mysql.binlog.event.deserialization.json.JsonBinary.
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: WriteRowsEventDataParser.java From light-eventuate-4j with Apache License 2.0 | 6 votes |
@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)) ); }