Class SimpleKafkaHeaderMapper

    • Constructor Detail

      • SimpleKafkaHeaderMapper

        public SimpleKafkaHeaderMapper()
        Construct an instance with the default object mapper and default header patterns for outbound headers; all inbound headers are mapped. The default pattern list is "!id", "!timestamp" and "*". In addition, most of the headers in KafkaHeaders are never mapped as headers since they represent data in consumer/producer records.
      • SimpleKafkaHeaderMapper

        public 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. The patterns are applied in order, stopping on the first match (positive or negative). Patterns are negated by preceding them with "!". The patterns will replace the default patterns; you generally should not map the "id" and "timestamp" headers. Note: most of the headers in KafkaHeaders are never mapped as headers since they represent data in consumer/producer records.
        Parameters:
        patterns - the patterns.
        See Also:
        PatternMatchUtils.simpleMatch(String, String)
    • Method Detail

      • forInboundOnlyWithMatchers

        public static SimpleKafkaHeaderMapper forInboundOnlyWithMatchers​(java.lang.String... patterns)
        Create an instance for inbound mapping only with pattern matching.
        Parameters:
        patterns - the patterns to match.
        Returns:
        the header mapper.
        Since:
        2.8.8
      • fromHeaders

        public void fromHeaders​(org.springframework.messaging.MessageHeaders headers,
                                org.apache.kafka.common.header.Headers target)
        Description copied from interface: KafkaHeaderMapper
        Map from the given MessageHeaders to the specified target headers.
        Parameters:
        headers - the abstracted MessageHeaders.
        target - the native target headers.
      • toHeaders

        public void toHeaders​(org.apache.kafka.common.header.Headers source,
                              java.util.Map<java.lang.String,​java.lang.Object> target)
        Description copied from interface: KafkaHeaderMapper
        Map from the given target headers to abstracted MessageHeaders.
        Parameters:
        source - the native target headers.
        target - the target headers.