Bugfixes
This commit is contained in:
parent
3dd6241e2c
commit
4c4b7a3677
@ -7,6 +7,9 @@ public class ClientBoundEventDeserializer implements Deserializer<ClientBoundEve
|
||||
|
||||
@Override
|
||||
public ClientBoundEvent deserialize(String topic, byte[] data) {
|
||||
if (data == null || data.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return LiveAtomixReactiveApiClient.deserializeEvent(data);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ public class ClientBoundEventSerializer implements Serializer<ClientBoundEvent>
|
||||
|
||||
@Override
|
||||
public byte[] serialize(String topic, ClientBoundEvent data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
return ReactiveApiPublisher.serializeEvent(data);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ public class DynamicAtomixReactiveApiClient implements ReactiveApiClient, AutoCl
|
||||
private final Flux<Long> liveIdChange;
|
||||
private final Mono<Long> liveIdResolution;
|
||||
|
||||
private volatile boolean closed;
|
||||
|
||||
DynamicAtomixReactiveApiClient(AtomixReactiveApi api, KafkaConsumer kafkaConsumer, long userId, String subGroupId) {
|
||||
this.api = api;
|
||||
this.eventService = api.getAtomix().getEventService();
|
||||
@ -40,6 +42,7 @@ public class DynamicAtomixReactiveApiClient implements ReactiveApiClient, AutoCl
|
||||
|
||||
clientBoundEvents = kafkaConsumer.consumeMessages(subGroupId, true, userId)
|
||||
.doOnNext(e -> liveId.set(e.liveId()))
|
||||
.takeWhile(n -> !closed)
|
||||
.share();
|
||||
|
||||
liveIdChange = this.clientBoundEvents()
|
||||
@ -117,6 +120,7 @@ public class DynamicAtomixReactiveApiClient implements ReactiveApiClient, AutoCl
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.closed = true;
|
||||
liveIdSubscription.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,9 @@ public class LiveAtomixReactiveApiClient implements ReactiveApiClient {
|
||||
|
||||
static TdApi.Object deserializeResponse(byte[] bytes) {
|
||||
try {
|
||||
if (bytes == null || bytes.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return TdApi.Deserializer.deserialize(new DataInputStream(new ByteArrayInputStream(bytes)));
|
||||
} catch (IOException ex) {
|
||||
throw new SerializationException(ex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user