Class AbstractKafkaHeaderMapper

    • Field Detail

      • logger

        protected final org.springframework.core.log.LogAccessor logger
    • Constructor Detail

      • AbstractKafkaHeaderMapper

        public AbstractKafkaHeaderMapper​(java.lang.String... patterns)
    • Method Detail

      • setMapAllStringsOut

        public void setMapAllStringsOut​(boolean mapAllStringsOut)
        Set to true to map all String valued outbound headers to byte[]. To map to a String for inbound, there must be an entry in the rawMappedHeaders map.
        Parameters:
        mapAllStringsOut - true to map all strings.
        Since:
        2.2.5
        See Also:
        setRawMappedHeaders(Map)
      • getCharset

        protected java.nio.charset.Charset getCharset()
      • setCharset

        public void setCharset​(java.nio.charset.Charset charset)
        Set the charset to use when mapping String-valued headers to/from byte[]. Default UTF-8.
        Parameters:
        charset - the charset.
        Since:
        2.2.5
        See Also:
        setRawMappedHeaders(Map)
      • setRawMappedHeaders

        public void setRawMappedHeaders​(java.util.Map<java.lang.String,​java.lang.Boolean> rawMappedHeaders)
        Set the headers to not perform any conversion on (except String to byte[] for outbound). Inbound headers that match will be mapped as byte[] unless the corresponding boolean in the map value is true, in which case it will be mapped as a String.
        Parameters:
        rawMappedHeaders - the header names to not convert and
        Since:
        2.2.5
        See Also:
        setCharset(Charset), setMapAllStringsOut(boolean)
      • matches

        protected boolean matches​(java.lang.String header,
                                  java.lang.Object value)
      • matches

        protected boolean matches​(java.lang.String header)
      • headerValueToAddOut

        protected java.lang.Object headerValueToAddOut​(java.lang.String key,
                                                       java.lang.Object value)
        Check if the value is a String and convert to byte[], if so configured.
        Parameters:
        key - the header name.
        value - the header value.
        Returns:
        the value to add.
        Since:
        2.2.5
      • headerValueToAddIn

        protected java.lang.Object headerValueToAddIn​(org.apache.kafka.common.header.Header header)
        Check if the header value should be mapped to a String, if so configured.
        Parameters:
        header - the header.
        Returns:
        the value to add.