• 【转】SENDING KEY VALUE MESSAGES WITH THE KAFKA CONSOLE PRODUCER


    SENDING KEY VALUE MESSAGES WITH THE KAFKA CONSOLE PRODUCER

    When working with Kafka you might find yourself using the kafka-console-producer (kafka-console-producer.sh). The kafka-console-producer is a program included with Kafka that creates messages from command line input (STDIN).

    However, simply sending lines of text will result in messages with null keys. In order to send messages with both keys and values you must set the parse.key and key.separator properties on the command line when running the producer.

    The below example sets the parse.key property to true, and specifies the key.separator as “:“. The keys in the sample messages below are “key1”, “key2”, “key3”, with the values being “value1”, “value2”, “value3”.

    If you haven’t installed Kafka yet, see our Kafka Quickstart Tutorial to get up and running quickly.

  • 相关阅读:
    Set,List,Map的区别
    阅读笔记15
    阅读笔记14
    阅读笔记13
    阅读笔记12
    阅读笔记11
    阅读笔记10
    架构漫谈读后感
    阅读笔记1
    暑期周记8
  • 原文地址:https://www.cnblogs.com/oxspirt/p/11510216.html
Copyright © 2020-2023  润新知