Skip to content

Commit c04660e

Browse files
committed
propagate connection errors
1 parent 9ae54e5 commit c04660e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

hivemq-edge/src/main/java/com/hivemq/protocols/ProtocolAdapterWrapper.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,17 @@ public boolean startSouthbound() {
197197
}
198198
return output.getStartFuture();
199199
}, sharedAdapterExecutor) // Use shared executor to reduce thread overhead
200-
.thenCompose(Function.identity()).handle((ignored, error) -> {
200+
.thenCompose(Function.identity()).whenComplete((ignored, error) -> {
201201
if (error != null) {
202202
log.error("Error starting adapter", error);
203203
stopAfterFailedStart();
204-
// Return null - cleanup done, adapter in STOPPED state
205-
// Callers should check getRuntimeStatus() to determine if start succeeded
206-
return null;
207204
} else {
208-
return attemptStartingConsumers(moduleServices.eventService()).map(startException -> {
205+
attemptStartingConsumers(moduleServices.eventService()).ifPresent(startException -> {
209206
log.error("Failed to start adapter with id {}", adapter.getId(), startException);
210207
stopAfterFailedStart();
211-
// Return null - cleanup done, adapter in STOPPED state
212-
return (Void) null;
213-
}).orElse(null);
208+
// Propagate the exception - this will fail the future
209+
throw new RuntimeException("Failed to start consumers", startException);
210+
});
214211
}
215212
}).whenComplete((result, throwable) -> {
216213
// Clear the current operation when complete

0 commit comments

Comments
 (0)