public class SimpleKafkaHeaderMapper extends AbstractKafkaHeaderMapper
AbstractKafkaHeaderMapper.setRawMappedHeaders(Map).
Most headers in KafkaHeaders are not mapped on outbound messages.
The exceptions are correlation and reply headers for request/replyAbstractKafkaHeaderMapper.HeaderMatcher, AbstractKafkaHeaderMapper.NeverMatchHeaderMatcher, AbstractKafkaHeaderMapper.SimplePatternBasedHeaderMatcherlogger| Constructor and Description |
|---|
SimpleKafkaHeaderMapper()
Construct an instance with the default object mapper and default header patterns
for outbound headers; all inbound headers are mapped.
|
SimpleKafkaHeaderMapper(java.lang.String... patterns)
Construct an instance with a default object mapper and the provided header patterns
for outbound headers; all inbound headers are mapped.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromHeaders(org.springframework.messaging.MessageHeaders headers,
org.apache.kafka.common.header.Headers target)
Map from the given
MessageHeaders to the specified target message. |
void |
toHeaders(org.apache.kafka.common.header.Headers source,
java.util.Map<java.lang.String,java.lang.Object> target)
Map from the given target message to abstracted
MessageHeaders. |
addMatchers, getCharset, headerValueToAddIn, headerValueToAddOut, matches, matches, setCharset, setMapAllStringsOut, setRawMappedHeaderspublic SimpleKafkaHeaderMapper()
"!id", "!timestamp" and "*". In addition, most of the headers in
KafkaHeaders are never mapped as headers since they represent data in
consumer/producer records.public SimpleKafkaHeaderMapper(java.lang.String... patterns)
"id" and "timestamp" headers. Note:
most of the headers in KafkaHeaders are never mapped as headers since they
represent data in consumer/producer records.patterns - the patterns.PatternMatchUtils.simpleMatch(String, String)public void fromHeaders(org.springframework.messaging.MessageHeaders headers,
org.apache.kafka.common.header.Headers target)
KafkaHeaderMapperMessageHeaders to the specified target message.headers - the abstracted MessageHeaders.target - the native target message.public void toHeaders(org.apache.kafka.common.header.Headers source,
java.util.Map<java.lang.String,java.lang.Object> target)
KafkaHeaderMapperMessageHeaders.source - the native target message.target - the target headers.