-
Notifications
You must be signed in to change notification settings - Fork 36
[volume - 8] Decoupling with Kafka #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: pmh5574
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ์์ฝ๊ฒฐ์ ๋๋ฉ์ธ์ ์ด๋ฒคํธ ๊ธฐ๋ฐ ์ํคํ ์ฒ๋ฅผ ๋์ ํ๋ ๋ณ๊ฒฝ์ฌํญ์ ๋๋ค. Kafka ๋ชจ๋์ ์์กด์ฑ์ ์ถ๊ฐํ๊ณ , ๊ฒฐ์ ์ฑ๊ณต/์คํจ ์ด๋ฒคํธ๋ฅผ ์ ์ํ ํ Kafka๋ฅผ ํตํด ๋ฐํํฉ๋๋ค. ์ฃผ๋ฌธ๊ณผ ์ํ ๋๋ฉ์ธ์ ์ด๋ฒคํธ ๋ฆฌ์ค๋๊ฐ ์ด๋ฌํ ์ด๋ฒคํธ๋ฅผ ์๋นํฉ๋๋ค. Walkthrough๊ฒฐ์ ๊ฒฐ๊ณผ๋ฅผ Kafka ๊ธฐ๋ฐ ์ด๋ฒคํธ๋ก ๋ฐํํ๋ ๊ธฐ๋ฅ์ด ์ถ๊ฐ๋ฉ๋๋ค. PaymentEvent์ PaymentEventPublisher๊ฐ ๋๋ฉ์ธ ๊ณ์ธต์์ ์ ์๋๊ณ , PaymentCoreEventPublisher๊ฐ ์ด๋ฅผ ๊ตฌํํ์ฌ Kafka ํ ํฝ์ ๋ฉ์์ง๋ฅผ ๋ฐํํฉ๋๋ค. PaymentFacade๊ฐ ์์ ๋์ด ๊ฒฐ์ ์ฑ๊ณต/์คํจ ์ ํด๋น ์ด๋ฒคํธ๋ฅผ ๋ฐํํ๋ฉฐ, ์ฃผ๋ฌธ๊ณผ ์ํ ๋ฆฌ์ค๋๊ฐ ์ด๋ฒคํธ๋ฅผ ์๋นํฉ๋๋ค. Changes
Sequence DiagramsequenceDiagram
participant Client
participant PaymentFacade
participant PaymentEventPublisher
participant KafkaTemplate
participant Kafka
participant OrderListener
participant ProductListener
Client->>PaymentFacade: processPayment()
alt Payment Success
PaymentFacade->>PaymentEventPublisher: publish(PaymentPaid)
PaymentEventPublisher->>KafkaTemplate: send(payment.paid topic)
KafkaTemplate->>Kafka: publish message
Kafka->>OrderListener: consume message (batch)
Kafka->>ProductListener: consume message (batch)
OrderListener->>OrderListener: process & acknowledge
ProductListener->>ProductListener: process & acknowledge
else Payment Failed
PaymentFacade->>PaymentEventPublisher: publish(PaymentFailed)
PaymentEventPublisher->>KafkaTemplate: send(payment.failed topic)
KafkaTemplate->>Kafka: publish message
end
Estimated code review effort๐ฏ 3 (Moderate) | โฑ๏ธ ~25 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touchesโ Failed checks (2 warnings)
โ Passed checks (1 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
๐งน Nitpick comments (5)
apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEventPublisher.java (2)
3-3: import ์คํ์ผ์ ์ผ๊ด์ฑ์ ๊ฐ์ ํ์ธ์.
PaymentPaid๋ ๋ช ์์ ์ผ๋ก import๋์ด ์ฌ์ฉ๋์ง๋ง,PaymentFailed๋ ์์ ํ ํจํค์ง ๊ฒฝ๋ก๋ก ์ฐธ์กฐ๋ฉ๋๋ค. ์ผ๊ด์ฑ์ ์ํด ๋ ์ด๋ฒคํธ ํ์ ๋ชจ๋ ๋์ผํ ๋ฐฉ์์ผ๋ก importํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.๐ ์์ ์ ์
package com.loopers.domain.payment; import com.loopers.domain.payment.PaymentEvent.PaymentPaid; +import com.loopers.domain.payment.PaymentEvent.PaymentFailed; public interface PaymentEventPublisher { void publish(PaymentPaid paymentCreated); - void publish(PaymentEvent.PaymentFailed paymentFailed); + void publish(PaymentFailed paymentFailed); }Also applies to: 7-7
6-6: ๋ฉ์๋ ํ๋ผ๋ฏธํฐ ์ด๋ฆ์ ์์ ํ์ธ์.์ฒซ ๋ฒ์งธ
publish๋ฉ์๋์ ํ๋ผ๋ฏธํฐ ์ด๋ฆ์ดpaymentCreated์ธ๋ฐ, ์ค์ ๋ก๋PaymentPaidํ์ ์ ๋ฐ์ต๋๋ค. ํ๋ผ๋ฏธํฐ ์ด๋ฆ์paymentPaid๋ก ๋ณ๊ฒฝํ์ฌ ํ์ ๊ณผ ์ผ์น์ํค๋ ๊ฒ์ด ๋ช ํํฉ๋๋ค.๐ ์์ ์ ์
- void publish(PaymentPaid paymentCreated); + void publish(PaymentPaid paymentPaid);apps/commerce-api/src/main/java/com/loopers/interfaces/event/product/ProductEventListener.java (1)
13-24: ์ด๋ฒคํธ ์ฒ๋ฆฌ ๋ก์ง ๊ตฌํ์ด ํ์ํฉ๋๋ค.๋ฆฌ์ค๋๊ฐ ๋ฐฐ์น ๋ชจ๋๋ก ์ฌ๋ฐ๋ฅด๊ฒ ์ค์ ๋์์ง๋ง, ๋ฉ์์ง ์ฒ๋ฆฌ ๋ก์ง์ด ์ฃผ์ ์ฒ๋ฆฌ๋์ด ์ฆ์ acknowledgment๋ง ์ํํฉ๋๋ค. ๊ฒฐ์ ์๋ฃ ์ด๋ฒคํธ์ ๋ํ ์ํ ๊ด๋ จ ๋น์ฆ๋์ค ๋ก์ง(์: ์ฌ๊ณ ์ ๋ฐ์ดํธ, ํต๊ณ ์ง๊ณ ๋ฑ)์ ๊ตฌํํด์ผ ํฉ๋๋ค.
Based on learnings, ์ด ์ฝ๋๋ฒ ์ด์ค์์๋ Kafka ์ปจ์๋จธ๊ฐ ์๋ฌ ์ฒ๋ฆฌ๋ฅผ EventInboxAspect๋ฅผ ํตํด ์๋น์ค ๋ ์ด์ด์ ์์ํ๋ฏ๋ก, ์๋น์ค ๋ฉ์๋์
@InboxEvent์ ๋ ธํ ์ด์ ์ ์ถ๊ฐํ์ฌ ์คํจ ์ ์๋์ผ๋ก ์ฒ๋ฆฌ๋๋๋ก ํ ์ ์์ต๋๋ค.์ด๋ฒคํธ ์ฒ๋ฆฌ ๋ก์ง ๊ตฌํ์ ๋์๋๋ฆด๊น์? ๋๋ ์ด ์์ ์ ์ถ์ ํ ์ด์๋ฅผ ์์ฑํ์๊ฒ ์ต๋๊น?
apps/commerce-api/src/main/java/com/loopers/interfaces/event/order/OrderEventListener.java (1)
13-24: ์ฃผ๋ฌธ ์ด๋ฒคํธ ์ฒ๋ฆฌ ๋ก์ง ๊ตฌํ์ด ํ์ํฉ๋๋ค.ProductEventListener์ ๋์ผํ ํจํด์ผ๋ก, ๋ฉ์์ง ์ฒ๋ฆฌ ๋ก์ง์ด ์ฃผ์ ์ฒ๋ฆฌ๋์ด ์์ต๋๋ค. ๊ฒฐ์ ์๋ฃ ์ด๋ฒคํธ์ ๋ํ ์ฃผ๋ฌธ ๊ด๋ จ ๋น์ฆ๋์ค ๋ก์ง(์: ์ฃผ๋ฌธ ์ํ ์ ๋ฐ์ดํธ, ์๋ฆผ ๋ฐ์ก ๋ฑ)์ ๊ตฌํํด์ผ ํฉ๋๋ค.
payment.paidํ ํฝ์ ๊ตฌ๋ ํ๋ ์ฌ๋ฌ ์ปจ์๋จธ ๊ทธ๋ฃน(order, product)์ด ์กด์ฌํ์ฌ ํฌ์์ ํจํด์ ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌํํ๊ณ ์์ต๋๋ค.Based on learnings, EventInboxAspect๋ฅผ ํ์ฉํ ์๋ฌ ์ฒ๋ฆฌ๋ฅผ ์ํด ์๋น์ค ๋ฉ์๋์
@InboxEvent์ ๋ ธํ ์ด์ ์ ์ถ๊ฐํ ์ ์์ต๋๋ค.apps/commerce-api/src/main/java/com/loopers/infrastructure/payment/PaymentCoreEventPublisher.java (1)
14-15: ํ ํฝ ์ด๋ฆ์ ์ค์ ํ์ผ๋ก ์ธ๋ถํํ์ธ์.ํ๋์ฝ๋ฉ๋ ํ ํฝ ์ด๋ฆ์ ํ๊ฒฝ๋ณ๋ก ๋ค๋ฅธ ํ ํฝ์ ์ฌ์ฉํ๊ฑฐ๋ ํ ํฝ ์ด๋ฆ์ ๋ณ๊ฒฝํ ๋ ์ฝ๋ ์์ ์ด ํ์ํฉ๋๋ค.
application.yml๋๋ ๋ณ๋์ ์ค์ ํด๋์ค๋ก ์ธ๋ถํํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.๐ ์ค์ ์ธ๋ถํ ์์
application.yml์ ์ถ๊ฐ:
payment: kafka: topics: paid: payment.paid failed: payment.failed์ฝ๋ ์์ :
+@Value("${payment.kafka.topics.paid}") -private static final String paidTopic = "payment.paid"; +private final String paidTopic; +@Value("${payment.kafka.topics.failed}") -private static final String failedTopic = "payment.failed"; +private final String failedTopic;
๐ Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (8)
apps/commerce-api/build.gradle.kts(1 hunks)apps/commerce-api/src/main/java/com/loopers/application/payment/PaymentFacade.java(4 hunks)apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEvent.java(1 hunks)apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEventPublisher.java(1 hunks)apps/commerce-api/src/main/java/com/loopers/infrastructure/payment/PaymentCoreEventPublisher.java(1 hunks)apps/commerce-api/src/main/java/com/loopers/interfaces/event/order/OrderEventListener.java(1 hunks)apps/commerce-api/src/main/java/com/loopers/interfaces/event/product/ProductEventListener.java(1 hunks)modules/kafka/src/main/resources/kafka.yml(1 hunks)
๐งฐ Additional context used
๐ง Learnings (5)
๐ Common learnings
Learnt from: HongChangMo
Repo: Loopers-dev-lab/loopers-spring-java-template PR: 156
File: apps/pg-simulator/src/main/kotlin/com/loopers/interfaces/api/payment/PaymentApi.kt:51-59
Timestamp: 2025-12-05T04:37:02.942Z
Learning: User HongChangMo prefers to skip detailed code reviews for the pg-simulator module (apps/pg-simulator/**) in the loopers-spring-java-template repository.
๐ Learning: 2025-12-18T13:24:54.339Z
Learnt from: kilian-develop
Repo: Loopers-dev-lab/loopers-spring-java-template PR: 190
File: apps/commerce-streamer/src/main/java/com/loopers/applications/streamer/consumer/product/IncreaseProductViewKafkaConsumer.java:25-35
Timestamp: 2025-12-18T13:24:54.339Z
Learning: In this codebase, Kafka consumers delegate error handling and event tracking to the service layer via EventInboxAspect. Service methods annotated with InboxEvent are intercepted by the aspect, which handles failures by saving failed EventInbox entries and logging errors. This centralized approach avoids duplicating error handling logic across multiple consumers.
Applied to files:
apps/commerce-api/src/main/java/com/loopers/interfaces/event/order/OrderEventListener.javaapps/commerce-api/src/main/java/com/loopers/interfaces/event/product/ProductEventListener.java
๐ Learning: 2025-12-18T01:01:55.894Z
Learnt from: jikimee64
Repo: Loopers-dev-lab/loopers-spring-kotlin-template PR: 65
File: modules/kafka/src/main/resources/kafka.yml:25-32
Timestamp: 2025-12-18T01:01:55.894Z
Learning: In Spring Boot Kafka configuration YAML, properties inside spring.kafka.producer.properties and spring.kafka.consumer.properties maps must use exact Kafka client property names with dot notation, and must be quoted with bracket notation like "[enable.idempotence]": true and "[enable.auto.commit]": false to prevent YAML from parsing dots as nested keys. Spring Boot's relaxed binding only applies to top-level Spring Kafka properties, not to the properties map.
Applied to files:
modules/kafka/src/main/resources/kafka.yml
๐ Learning: 2025-12-07T12:45:45.556Z
Learnt from: toongri
Repo: Loopers-dev-lab/loopers-spring-kotlin-template PR: 52
File: apps/commerce-api/src/main/kotlin/com/loopers/domain/payment/Payment.kt:160-181
Timestamp: 2025-12-07T12:45:45.556Z
Learning: In the Payment.confirmPayment method in com.loopers.domain.payment.Payment, the when-branch order is intentionally designed with business logic checks before timeout: (1) check SUCCESS/FAILED status first, (2) check for null match (business failure), (3) check timeout only as last resort for PENDING transactions. If matched transaction is PENDING and not timed out, no branch matches and payment stays IN_PROGRESS for scheduler retry. This design prioritizes business outcome determination over time-based fallback.
Applied to files:
apps/commerce-api/src/main/java/com/loopers/application/payment/PaymentFacade.java
๐ Learning: 2025-11-30T15:44:28.336Z
Learnt from: ghojeong
Repo: Loopers-dev-lab/loopers-spring-kotlin-template PR: 48
File: apps/commerce-api/src/main/kotlin/com/loopers/application/order/OrderFacade.kt:80-83
Timestamp: 2025-11-30T15:44:28.336Z
Learning: User ghojeong prefers explicit state management over transaction rollback for handling payment failures in order creation flow. When payment fails after order creation, the order should be explicitly marked as cancelled and persisted, rather than relying on transaction rollback.
Applied to files:
apps/commerce-api/src/main/java/com/loopers/application/payment/PaymentFacade.java
๐งฌ Code graph analysis (5)
apps/commerce-api/src/main/java/com/loopers/interfaces/event/order/OrderEventListener.java (1)
apps/commerce-api/src/main/java/com/loopers/interfaces/event/product/ProductEventListener.java (1)
Component(10-25)
apps/commerce-api/src/main/java/com/loopers/application/payment/PaymentFacade.java (1)
apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEvent.java (1)
PaymentEvent(3-14)
apps/commerce-api/src/main/java/com/loopers/interfaces/event/product/ProductEventListener.java (1)
apps/commerce-api/src/main/java/com/loopers/interfaces/event/order/OrderEventListener.java (1)
Component(10-25)
apps/commerce-api/src/main/java/com/loopers/infrastructure/payment/PaymentCoreEventPublisher.java (3)
apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEvent.java (1)
PaymentEvent(3-14)apps/commerce-api/src/main/java/com/loopers/interfaces/event/order/OrderEventListener.java (1)
Component(10-25)apps/commerce-api/src/main/java/com/loopers/interfaces/event/product/ProductEventListener.java (1)
Component(10-25)
apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEventPublisher.java (1)
apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEvent.java (1)
PaymentEvent(3-14)
๐ Additional comments (6)
modules/kafka/src/main/resources/kafka.yml (1)
10-10: ์ ๋ขฐ์ฑ ์๋ Kafka ์ค์ ์ด ์ ์ฉ๋์์ต๋๋ค.
acks: all๊ณผ idempotence ์ค์ (๋๊ดํธ ํ๊ธฐ๋ฒ ์์ ํ)์ ์กฐํฉ์ ๋ฉ์์ง ์์ค์ ๋ฐฉ์งํ๊ณ ์ค๋ณต ์ ์ก์ ๋ฐฉ์งํ๋ ์ข์ ๊ตฌ์ฑ์ ๋๋ค. ์๋ ํ ํฝ ์์ฑ์ด ํ์ฑํ๋์ด ์์ผ๋ฏ๋ก ํ๋ก๋์ ํ๊ฒฝ์์๋ ํ ํฝ์ ์ฌ์ ์ ์์ฑํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค.Also applies to: 18-20
apps/commerce-api/build.gradle.kts (1)
5-5: Kafka ๋ชจ๋ ์์กด์ฑ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ถ๊ฐ๋์์ต๋๋ค.commerce-api์์ Kafka ๊ธฐ๋ฐ ์ด๋ฒคํธ ๋ฐํ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์๋๋ก ์ ์ ํ๊ฒ ์์กด์ฑ์ด ์ถ๊ฐ๋์์ต๋๋ค.
apps/commerce-api/src/main/java/com/loopers/application/payment/PaymentFacade.java (2)
93-93: ์ด๋ฒคํธ ๋ฐํ ์คํจ ์ ํธ๋์ญ์ ์ฒ๋ฆฌ๋ฅผ ๊ฒํ ํ์ธ์.์ด๋ฒคํธ ๋ฐํ์ด
@Transactional๋ฉ์๋ ๋ด์์ ๋๊ธฐ์ ์ผ๋ก ์ํ๋ฉ๋๋ค. Kafka๊ฐ ์ฌ์ฉ ๋ถ๊ฐ๋ฅํ๊ฑฐ๋ ๋ฐํ์ ์คํจํ๋ฉด ์ ์ฒด ๊ฒฐ์ ํธ๋์ญ์ ์ด ๋กค๋ฐฑ๋ ์ ์์ต๋๋ค.๋ค์ ์ฌํญ๋ค์ ๊ณ ๋ คํด์ผ ํฉ๋๋ค:
- ์ด๋ฒคํธ ๋ฐํ ์คํจ๊ฐ ๊ฒฐ์ ํธ๋์ญ์ ์ ๋กค๋ฐฑํด์ผ ํ๋์ง ํ์ธ
- ์ด๋ฒคํธ ๋ฐํ์ ๋น๋๊ธฐ๋ก ์ฒ๋ฆฌํ๊ฑฐ๋ ํธ๋์ญ์ ์ปค๋ฐ ํ ๋ฐํํ๋ ๋ฐฉ์ ๊ฒํ
KafkaTemplate.send()์ ์๋ฌ ์ฒ๋ฆฌ ์ถ๊ฐBased on learnings, ๊ฒฐ์ ์คํจ ์ ๋ช ์์ ์ธ ์ํ ๊ด๋ฆฌ๋ฅผ ์ ํธํ๋ฏ๋ก, ์ด๋ฒคํธ ๋ฐํ ์คํจ ์์๋ ๊ฒฐ์ ์ํ๋ ์ ์ง๋์ด์ผ ํ ์ ์์ต๋๋ค.
122-122: ๋์ผํ ์ด๋ฒคํธ ๋ฐํ ํจํด์ด ์ ์ฉ๋์์ต๋๋ค.๊ฒฐ์ ์คํจ ์์๋ ์ด๋ฒคํธ ๋ฐํ์ด ๋๊ธฐ์ ์ผ๋ก ์ํ๋ฉ๋๋ค. Line 93์ ์ฑ๊ณต ์ผ์ด์ค์ ๋์ผํ ํธ๋์ญ์ ๋ฐ ์๋ฌ ์ฒ๋ฆฌ ๊ณ ๋ ค์ฌํญ์ด ์ ์ฉ๋ฉ๋๋ค.
apps/commerce-api/src/main/java/com/loopers/domain/payment/PaymentEvent.java (1)
3-14: ๋๋ฉ์ธ ์ด๋ฒคํธ ๋ชจ๋ธ์ด ์ ์ค๊ณ๋์์ต๋๋ค.Java record๋ฅผ ํ์ฉํ์ฌ ๋ถ๋ณ ์ด๋ฒคํธ ํ์ ์ ์ ์ํ๊ณ , ๊ฐ ์ด๋ฒคํธ์ ๋ํ ํฉํ ๋ฆฌ ๋ฉ์๋๋ฅผ ์ ๊ณตํ๋ ๊น๋ํ ๊ตฌํ์ ๋๋ค. Payment ์ํฐํฐ๋ก๋ถํฐ ์ด๋ฒคํธ๋ฅผ ์ผ๊ด๋๊ฒ ์์ฑํ ์ ์์ต๋๋ค.
apps/commerce-api/src/main/java/com/loopers/infrastructure/payment/PaymentCoreEventPublisher.java (1)
20-22: ์ด๋ฒคํธ ๋ฐํ ์คํจ์ ๋ํ ์๋ฌ ์ฒ๋ฆฌ๋ฅผ ์ถ๊ฐํ์ธ์.
kafkaTemplate.send()์ ๋ฐํ๊ฐ(CompletableFuture)์ ๋ฌด์ํ๊ณ ์์ด ๋ฐํ ์คํจ๋ฅผ ๊ฐ์งํ ์ ์์ต๋๋ค. ์ด๋ฒคํธ ๋ฐํ ์คํจ ์ ๋ก๊น , ์ฌ์๋, ๋๋ ๋์ฒด ์ฒ๋ฆฌ๊ฐ ํ์ํฉ๋๋ค.๐ ์๋ฌ ์ฒ๋ฆฌ ์ถ๊ฐ ์์
@Override public void publish(final PaymentPaid paymentCreated) { - kafkaTemplate.send(paidTopic, paymentCreated.payment().getId(), paymentCreated); + kafkaTemplate.send(paidTopic, paymentCreated.payment().getId(), paymentCreated) + .whenComplete((result, ex) -> { + if (ex != null) { + log.error("Failed to publish PaymentPaid event for payment ID: {}", + paymentCreated.payment().getId(), ex); + // Consider: throw exception, retry, or save to dead letter queue + } else { + log.info("Successfully published PaymentPaid event for payment ID: {}", + paymentCreated.payment().getId()); + } + }); }Also applies to: 25-27
โ Skipped due to learnings
Learnt from: kilian-develop Repo: Loopers-dev-lab/loopers-spring-java-template PR: 190 File: apps/commerce-streamer/src/main/java/com/loopers/applications/streamer/consumer/product/IncreaseProductViewKafkaConsumer.java:25-35 Timestamp: 2025-12-18T13:24:54.339Z Learning: In this codebase, Kafka consumers delegate error handling and event tracking to the service layer via EventInboxAspect. Service methods annotated with InboxEvent are intercepted by the aspect, which handles failures by saving failed EventInbox entries and logging errors. This centralized approach avoids duplicating error handling logic across multiple consumers.
| properties: | ||
| enable.idempotence: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kafka ํ๋ก๋์ ์์ฑ์ ํ๊ธฐ๋ฒ์ ์์ ํด์ผ ํฉ๋๋ค.
Spring Boot์ spring.kafka.producer.properties ๋งต ๋ด๋ถ์์๋ ์ (dot)์ ํฌํจํ Kafka ํด๋ผ์ด์ธํธ ์์ฑ ์ด๋ฆ์ ๋๊ดํธ ํ๊ธฐ๋ฒ์ผ๋ก ์์ฑํด์ผ ํฉ๋๋ค. ํ์ฌ enable.idempotence: true๋ YAML ํ์๊ฐ ์ค์ฒฉ๋ ํค๋ก ํด์ํ ์ ์์ต๋๋ค.
Based on learnings, Kafka ํด๋ผ์ด์ธํธ ์์ฑ์ ์ ํํ ์ด๋ฆ์ผ๋ก ์ธ์๋๋๋ก ๋๊ดํธ๋ก ๊ฐ์ธ์ผ ํฉ๋๋ค.
๐ ์์ ์ ์
producer:
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
retries: 3
acks: all
properties:
- enable.idempotence: true
+ "[enable.idempotence]": true๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| properties: | |
| enable.idempotence: true | |
| producer: | |
| key-serializer: org.apache.kafka.common.serialization.StringSerializer | |
| value-serializer: org.springframework.kafka.support.serializer.JsonSerializer | |
| retries: 3 | |
| acks: all | |
| properties: | |
| "[enable.idempotence]": true |
๐ค Prompt for AI Agents
In modules/kafka/src/main/resources/kafka.yml around lines 19 to 20, the Kafka
producer property key is written as enable.idempotence which YAML may parse as a
nested key; update the key to use Spring Boot's bracket notation for Kafka
client properties (i.e., wrap the full dotted property name in brackets and
quotes as the map key) so the client receives the correct "enable.idempotence"
setting and not a nested YAML structure.
๐ Summary
๐ฌ Review Points
โ Checklist
๐ References
Summary by CodeRabbit
๋ฆด๋ฆฌ์ค ๋ ธํธ
โ๏ธ Tip: You can customize this high-level summary in your review settings.