my-research / kafka

apache kafka docs & practical usages(with spring) that i composed

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apache kafka

학습하며 정리한 내용 & 개념과 카프카 사용 예제 코드 저장소입니다.

아래 테스트 코드를 통해 카프카의 기본 사용법에 대한 학습 테스트를 직접 수행할 수 있습니다

Kafka 101, 개념

kafka basics(카프카 기본), differences with others(다른 메시지 브로커와의 차이점), topics(토픽), partition(파티션), replication(리플리케이션), In-Sync-Replica(ISR), producer(프로듀서), producer & partition(프로듀서와 파티션), producer & acknowledgement(프로듀서와 ack), consumer(컨슈머), partition ordering(파티션과 순서 보장), consumer group(컨슈머 그룹), re balancing(리밸런싱), commit & offset(커밋과 오프셋),

학습 테스트

테스트는 기본적으로 spring embedded kafka 를 사용합니다. 또한 테스트를 위한 supports 를 제공하여 더욱 깔끔한 테스트를 제공합니다

kafka producer

kafka consumer

kafka test supports

  • EmbeddedKafka supports
    • @KafkaTest : EmbeddedKafka 를 이용하는 테스트 support
    • @SinglePartitionKafkaTest : Single partition 의 KafkaTest
    • @TriplePartitionKafkaTest : 3 개의 partition 을 가지는 KafkaTest
    • @EmptyTopicKafkaTest : Topic 자동 생성 옵션이 꺼진 KafkaTes
  • Junit supports
    • consumer record 에 대한 Junit Assertions
    • 카프카 connection error 를 위한 Junit Tiemout Extension
  • Helper
    • producer 테스트를 위한 helper 클래스
    • consumer 테스트를 위한 helper 클래스

run

Makefile 을 통해 간단히 kafka-ui 가 포함된 kafka 클러스터를 실행시킬 수 있습니다

prerequisites

  • docker
  • docker-compose

run kafka cluster with kafka ui

### cluster 실행
make up

### cluster 종료
make down

### cluster 확인
make ps

About

apache kafka docs & practical usages(with spring) that i composed


Languages

Language:Java 99.3%Language:Makefile 0.7%