Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void write(Chunk<? extends NotificationMessage> items) {
String key = String.valueOf(event.subscriptionInfo().get("subId"));

CompletableFuture<SendResult<String, String>> future =
kafkaTemplate.send("usage-noti", key, payload);
kafkaTemplate.send("usage", key, payload);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

토픽 이름 "usage"가 하드코딩되어 있습니다. InvoiceSendWriter에서 TOPIC 상수를 사용하는 것처럼, 이 클래스에서도 상수로 정의하여 사용하면 코드의 일관성과 유지보수성을 높일 수 있습니다.

다음과 같이 상수를 추가하고 사용하는 것을 권장합니다.

private static final String USAGE_NOTIFICATION_TOPIC = "usage";

// ...

kafkaTemplate.send(USAGE_NOTIFICATION_TOPIC, key, payload);


tasks.add(new NotificationSendTask(event, future));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@RequiredArgsConstructor
public class InvoiceSendWriter implements ItemWriter<InvoiceAggregateRecord>, ItemStream {

private static final String TOPIC = "invoice-noti";
private static final String TOPIC = "invoice";

private final KafkaTemplate<String, String> kafkaTemplate;
private final ObjectMapper objectMapper;
Expand Down
Loading