use of io.eventuate.tram.messaging.common.MessageImpl in project eventuate-tram-core by eventuate-tram.
the class WriteRowsEventDataParser method parseEventData.
@Override
public MessageWithDestination parseEventData(WriteRowsEventData eventData, String binlogFilename, long position) throws IOException {
if (columnOrders.isEmpty()) {
try {
getColumnOrders();
} catch (SQLException e) {
logger.error("Error getting metadata", e);
throw new RuntimeException(e);
}
}
String id = (String) getValue(eventData, ID);
String destination = (String) getValue(eventData, DESTINATION);
String payload = (String) getValue(eventData, PAYLOAD);
Map<String, String> headers = JSonMapper.fromJson((String) getValue(eventData, HEADERS), Map.class);
headers.put(Message.ID, id);
headers.put("binlogfile", binlogFilename);
headers.put("binlogposition", Long.toString(position));
return new MessageWithDestination(destination, new MessageImpl(payload, headers), new BinlogFileOffset(binlogFilename, position));
}
Aggregations