Skip to content

Commit

Permalink
use drainAndShutdown to gracefully shutdown the connection an minize …
Browse files Browse the repository at this point in the history
…loss of messages

Signed-off-by: Yannic Klem <yannic.klem@bosch.io>
  • Loading branch information
Yannic92 committed Jul 15, 2021
1 parent d3ed384 commit 6893964
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.time.Instant;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -293,8 +294,7 @@ private void escalate(final DittoRuntimeException dittoRuntimeException) {

private void stop() {
if (consumerControl != null) {
// TODO use drainAndShutdown?
consumerControl.shutdown();
consumerControl.drainAndShutdown(new CompletableFuture<>(), materializer.executionContext());
consumerControl = null;
}
}
Expand Down

0 comments on commit 6893964

Please sign in to comment.