Update dependencies
This commit is contained in:
parent
9a2015ef56
commit
c92f0aa589
@ -26,6 +26,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CancellationException;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -469,7 +470,7 @@ public class AtomixReactiveApi implements ReactiveApi {
|
|||||||
Duration.ofSeconds(1)
|
Duration.ofSeconds(1)
|
||||||
))
|
))
|
||||||
.onErrorResume(ex -> {
|
.onErrorResume(ex -> {
|
||||||
if (ex instanceof MessagingException.NoRemoteHandler) {
|
if (ex instanceof MessagingException.NoRemoteHandler || ex instanceof CancellationException) {
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
} else {
|
} else {
|
||||||
return Mono.error(ex);
|
return Mono.error(ex);
|
||||||
|
@ -2,6 +2,7 @@ package it.tdlight.reactiveapi;
|
|||||||
|
|
||||||
import it.tdlight.reactiveapi.Event.ClientBoundEvent;
|
import it.tdlight.reactiveapi.Event.ClientBoundEvent;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.util.concurrent.CancellationException;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -94,8 +95,12 @@ public class DynamicAtomixReactiveApiClient extends BaseAtomixReactiveApiClient
|
|||||||
public void close() {
|
public void close() {
|
||||||
this.closed = true;
|
this.closed = true;
|
||||||
var clientBoundEventsSubscription = this.clientBoundEventsSubscription.get();
|
var clientBoundEventsSubscription = this.clientBoundEventsSubscription.get();
|
||||||
if (clientBoundEventsSubscription != null) {
|
if (clientBoundEventsSubscription != null && !clientBoundEventsSubscription.isDisposed()) {
|
||||||
clientBoundEventsSubscription.dispose();
|
try {
|
||||||
|
clientBoundEventsSubscription.dispose();
|
||||||
|
} catch (CancellationException ignored) {
|
||||||
|
LOG.debug("Reactive api client for user {} has been cancelled", userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class KafkaConsumer {
|
|||||||
public KafkaReceiver<Integer, ClientBoundEvent> createReceiver(@NotNull String groupId, @Nullable Long userId) {
|
public KafkaReceiver<Integer, ClientBoundEvent> createReceiver(@NotNull String groupId, @Nullable Long userId) {
|
||||||
Map<String, Object> props = new HashMap<>();
|
Map<String, Object> props = new HashMap<>();
|
||||||
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaParameters.bootstrapServers());
|
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.GROUP_ID_CONFIG, groupId);
|
||||||
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, IntegerDeserializer.class);
|
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, IntegerDeserializer.class);
|
||||||
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ClientBoundEventDeserializer.class);
|
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ClientBoundEventDeserializer.class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user