tryParseEventsSequenceId
public static Long tryParseEventsSequenceId(org.apache.kafka.clients.consumer.ConsumerRecord record)
Reads the header of a message produced by the events pipeline, and returns the sequence id embedded in it.
This works as followes:
1. If the _sequence_id and eventsmetadata headers are missing both - null is returned.
2. If eventsmetadata exists, it is parsed as a io.confluent.protobuf.cloud.events.v1.EventsMetadata, and
the value of the sequence id encoded in it is returned. If it exists and can't be parsed, we return null, and
don't fall back to any other header.
3. The eventsmetadata header does not exists, then _sequence_id is parsed as a decimal number encoded to a UTF-8
string. If it can't be parsed, null is returned.
Reference: https://confluentinc.atlassian.net/wiki/spaces/EV/pages/2674884870/Events+Metadata
- Parameters:
record
- the record to parse the headers of
- Returns:
- the sequence id if one could be parsed (see above), null otherwise.