Package pw.avvero.test.kafka
Class RecordSnapshotMapper
java.lang.Object
pw.avvero.test.kafka.RecordSnapshotMapper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrecordToSnapshot(org.apache.kafka.clients.consumer.ConsumerRecord<Object, Object> record, Map<String, Object> boundedHeaders) Converts aConsumerRecordto aRecordSnapshotwhile filtering headers based on a provided map of bound headers.
-
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 aConsumerRecordto aRecordSnapshotwhile 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 KafkaConsumerRecordto 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
RecordSnapshotinstance containing the filtered headers, key, and value from the original Kafka record.
-