
# email.send라는 토픽 생성 $ bin/kafka-topics.sh \ --bootstrap-server localhost:9092 \ --create --topic email.send
# email.send라는 토픽에 메시지 넣기 $ bin/kafka-console-producer.sh \ --bootstrap-server localhost:9092 \ --topic email.send # 위 명령어 입력 후 넣을 메시지 내용 입력하고 Enter 누르기 hello1 hello2 hello3 # 입력 다 했으면 Ctlr + c로 입력 상태 종료하기

아무런 에러가 뜨지 않았다면 토픽에 메시지가 잘 들어간 것이다. 이제 토픽에 넣은 메시지를 조회하는 방법에 대해 알아보자.

# email.send라는 토픽에 있는 메시지 꺼내기 $ bin/kafka-console-consumer.sh \ --bootstrap-server localhost:9092 \ --topic email.send \ --from-beginning
--from-beginning : 토픽에 저장된 가장 처음 메시지부터 출력해온다. email.send 토픽에 메시지를 추가로 넣어보자. $ bin/kafka-console-producer.sh \ --bootstrap-server localhost:9092 \ --topic email.send # 위 명령어 입력 후 넣을 메시지 내용 입력하고 Enter 누르기 hello4

email.send 토픽에 메시지를 넣자마자, email.send 토픽의 메시지를 조회하고 있는 터미널 창에서 실시간으로 메시지를 읽어오는 걸 확인할 수 있다. # 아래 명령어 다시 입력해보기 $ bin/kafka-console-consumer.sh \ --bootstrap-server localhost:9092 \ --topic email.send \ --from-beginning