Skip to content
Snippets Groups Projects
  1. Nov 28, 2020
    • Seok Won's avatar
      Create Producer using key · 539ce491
      Seok Won authored
      At line 34, we added key parameter.
      
      Whenever we use same key when sending a data, same key always use same partition.
      
      i.e)
      i = 0, key = "truck_1" -> partition_0
      i = 1, key = "truck_1" -> partition_0
      ...
      539ce491
    • Seok Won's avatar
      Create Simple Producer with Callback function · a624b66d
      Seok Won authored
      for example,
      
      whenever we send a data, this callback function will execute.
      
      새 메타데이터
      Topic: first-topic
      Partition: 2
      Offset: 13
      Timestamp: 1606555474565
      a624b66d
    • Seok Won's avatar
      Kafka Producer · 55c9af5c
      Seok Won authored
      Send "Hello World!" string to topic named "first-topic".
      
      Producer sends a data to Consumer asynchronous, so we have to flush to see results right away.
      
      Execute below command to see "Hello World!"
      
      >> kafka-console-consumer --bootstrap-server localhost:9092 --topic first-topic --group group-one
      55c9af5c
Loading