DBZ-1726 Implemented getting transaction-id metadata

This commit is contained in:
Chris Cranford 2020-03-10 11:45:04 -04:00 committed by Gunnar Morling
parent 3a4788cc33
commit ab8359b9cc

View File

@ -52,7 +52,17 @@ public Map<String, String> getEventSourcePosition(DataCollectionId source, Offse
@Override
public String getTransactionId(DataCollectionId source, OffsetContext offset, Object key, Struct value) {
// todo: DBZ-1726 for now this returns null; is there an implementation alternative?
return null;
if (value == null) {
return null;
}
final Struct sourceInfo = value.getStruct(Envelope.FieldName.SOURCE);
if (source == null) {
return null;
}
final Long txOrder = sourceInfo.getInt64(SourceInfo.TX_ORD);
if (txOrder == null) {
return null;
}
return Long.toString(txOrder);
}
}