Update dependencies

This commit is contained in:
Andrea Cavalli 2022-03-19 00:06:30 +01:00
parent 9a2015ef56
commit c92f0aa589
3 changed files with 10 additions and 4 deletions

View File

@ -26,6 +26,7 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
@ -469,7 +470,7 @@ public class AtomixReactiveApi implements ReactiveApi {
Duration.ofSeconds(1)
))
.onErrorResume(ex -> {
if (ex instanceof MessagingException.NoRemoteHandler) {
if (ex instanceof MessagingException.NoRemoteHandler || ex instanceof CancellationException) {
return Mono.empty();
} else {
return Mono.error(ex);

View File

@ -2,6 +2,7 @@ package it.tdlight.reactiveapi;
import it.tdlight.reactiveapi.Event.ClientBoundEvent;
import java.time.Duration;
import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicReference;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
@ -94,8 +95,12 @@ public class DynamicAtomixReactiveApiClient extends BaseAtomixReactiveApiClient
public void close() {
this.closed = true;
var clientBoundEventsSubscription = this.clientBoundEventsSubscription.get();
if (clientBoundEventsSubscription != null) {
clientBoundEventsSubscription.dispose();
if (clientBoundEventsSubscription != null && !clientBoundEventsSubscription.isDisposed()) {
try {
clientBoundEventsSubscription.dispose();
} catch (CancellationException ignored) {
LOG.debug("Reactive api client for user {} has been cancelled", userId);
}
}
super.close();
}

View File

@ -33,7 +33,7 @@ public class KafkaConsumer {
public KafkaReceiver<Integer, ClientBoundEvent> createReceiver(@NotNull String groupId, @Nullable Long userId) {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaParameters.bootstrapServers());
props.put(ConsumerConfig.CLIENT_ID_CONFIG, kafkaParameters.clientId());
props.put(ConsumerConfig.CLIENT_ID_CONFIG, kafkaParameters.clientId() + (userId != null ? ("_" + userId) : ""));
props.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, IntegerDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ClientBoundEventDeserializer.class);