안녕세계
Consumer 동작 방식1. Consumer가 Topic을 subscribe 합니다.2. poll()을 통해서, Partition에서 주기적으로 메시지를 가져옵니다.3. 메시지를 가져온 뒤 commit을 통해 __conusmer_offset에 다음에 읽을 offset을 기록합니다. [auto.offset.reset]Consumer Group에 읽을 offset이 없거나 기존 offset이 유효하지 않을 때 어디서부터 읽기 시작할지를 정하는 설정입니다. 같은 Consumer Group 안에서 Consumer를 껐다 켜는 경우에는, 보통 저장된 offset이 있으므로 기존 위치부터 이어서 읽습니다. 즉, auto.offset.reset은 Consumer 재시작 옵션이 아니라, 새 Consumer Group..
Producer 동작 방식kafkaTemplate 객체의 send() 메서드를 통해, Broker로 record(message)를 전송할 수 있습니다.kafkaTemplate.send() 메서드에는 topic / key / value / partition 등 다양한 인자 값을 넘길 수 있으며,send() 인자로 넘어간 값을 토대로 ProducerRecord 객체를 생성한 뒤 전송됩니다.참고) org.springframework.kafka.core.KafkaTemplate 1. kafkaTemplate.send() 시 ProducerRecord 객체를 전송합니다.2. Serializer가 ProducerRecord 객체를 Byte[] 로 직렬화합니다.3. Partitioner가 전략에 따라 특정 Topic..
TopicTopic은 N개의 Partition으로 구성되어 있는 log 파일입니다.Topic은 시간의 흐름에 따라 Record(message)가 물리적인 파일에 순차적으로 write 됩니다.PartitionTopic을 N개로 쪼갠 로그 조각이 Partition 입니다.개별 Partition 내에서 순서가 보장되는 단위Partition은 Kafka의 병렬 성능과 가용성 기능의 핵심 요소입니다.Record(message)는 병렬 성능과 가용성을 고려해 개별 Partition에 분산 저장됩니다.Partition 과 Offset논리/개념 계층 물리/저장 계층(Disk File 관점)Topic > Partition > Segment(로그 파일 조각) > Record Batch, (index/timeindex 파일..