spring-cloud-starter-stream-kafka sample
What is Kafka?
- Messaging System : publish and subscribe to streams of records
- Store System : store streams of records in a fault-tolerant durable way
- Stream Processing : Process streams of records as they occur
Kafka는 real-time 데이터를 처리하기 위한 통합된 플랫폼을 제공하기 위해 만들어졌다.
- 실시간 로그 수집 같은 대용량 이벤트 스트림을 지원하기 위한 높은 처리량
- 오프라인 시스템으로부터 주기적인 데이터 로드를 위해 큰 규모의 데이터 백로그를 다룸
- 전통적인 메세징 처리를 다루기 위한 Low-latency 전달
- Partitioned, Distributed, Real-time processing
- Fault-tolerance
-
System Requirements
Type Tool Version Compiler JDK 1.8 이상 Builder maven 3.2 이상 Framework Spring Boot 2.0.2 Spring Cloud Finchley.BUILD-SNAPSHOT -
run kafka
-
서버 시작
주키퍼 시작 bin/zookeeper-server-start.sh -daemon config/zookeeper.properties 카프카 시작 bin/kafka-server-start.sh -daemon config/server.properties
-
Topic 생성
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic topic_name
-
Topic 리스트 확인
bin/kafka-topics.sh --list --zookeeper localhost:2181
-
Producer (메세지 보내기)
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic topic_name > Hello World
-
Consumer (메세지 가져오기)
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topic_name --from-beginning > Hello World
-