Skip to content
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

[fix][broker] Fix NPE while publishing Metadata-Event with not init producer #24079

Merged
merged 1 commit into from
Mar 17, 2025
Merged
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 @@ -120,6 +120,7 @@ private void publishAsync(MetadataEvent event, CompletableFuture<Void> future) {
if (!isProducerStarted()) {
log.info("Producer is not started on {}, failed to publish {}", topicName, event);
future.completeExceptionally(new IllegalStateException("producer is not started yet"));
return;
}
producer.newMessage().value(event).sendAsync().thenAccept(__ -> {
log.info("successfully published metadata change event {}", event);
Expand All @@ -135,6 +136,7 @@ private void publishAsync(MetadataEvent event, CompletableFuture<Void> future) {
private void startProducer() {
if (isClosingOrClosed()) {
log.info("[{}] Skip to start new producer because the synchronizer is closed", topicName);
return;
}
if (producer != null) {
log.error("[{}] Failed to start the producer because the producer has been set, state: {}",
Expand Down
Loading