Interface MessageFormatter

  • All Superinterfaces:
    AutoCloseable, Closeable, Configurable

    public interface MessageFormatter
    extends Configurable, Closeable
    This interface allows to define Formatters that can be used to parse and format records read by a Consumer instance for display. The kafka-console-consumer has built-in support for MessageFormatter, via the --formatter flag. Kafka provides a few implementations to display records of internal topics such as __consumer_offsets, __transaction_state and the MirrorMaker2 topics.
    • Method Detail

      • init

        @Deprecated
        default void init​(Properties props)
        Deprecated.
        Use configure(Map) instead, this method is for backward compatibility with the older Formatter interface
        Initialises the MessageFormatter
        Parameters:
        props - Properties to configure the formatter
      • configure

        default void configure​(Map<String,​?> configs)
        Configures the MessageFormatter
        Specified by:
        configure in interface Configurable
        Parameters:
        configs - Map to configure the formatter
      • writeTo

        void writeTo​(ConsumerRecord<byte[],​byte[]> consumerRecord,
                     PrintStream output)
        Parses and formats a record for display
        Parameters:
        consumerRecord - the record to format
        output - the print stream used to output the record