Class RecordSnapshotMapper

java.lang.Object
pw.avvero.test.kafka.RecordSnapshotMapper

public class RecordSnapshotMapper extends Object
  • Constructor Details

    • RecordSnapshotMapper

      public RecordSnapshotMapper()
  • Method Details

    • recordToSnapshot

      public RecordSnapshot recordToSnapshot(org.apache.kafka.clients.consumer.ConsumerRecord<Object,Object> record, Map<String,Object> boundedHeaders)
      Converts a ConsumerRecord to a RecordSnapshot while filtering headers based on a provided map of bound headers. This method is designed to extract and use only the relevant headers that are present in both the original Kafka record and the provided map of bound headers. The bound headers map is typically generated by Spring and may contain additional metadata or system-related headers that are not part of the original record's headers.
      Parameters:
      record - The Kafka ConsumerRecord to be converted.
      boundedHeaders - A map of headers provided by Spring that includes both user-defined headers and potentially extraneous system headers. unrelated or system headers.
      Returns:
      A RecordSnapshot instance containing the filtered headers, key, and value from the original Kafka record.