use of org.yamcs.protobuf.Web.WebSocketServerMessage.WebSocketReplyData in project yamcs-studio by yamcs.
the class ParameterSubscriptionBundler method run.
@Override
public void run() {
if (!yamcsClient.isConnected()) {
return;
}
ParameterWebSocketRequest a;
while ((a = pendingMessages.poll()) != null) {
while (pendingMessages.peek() != null && isMergeable(a, pendingMessages.peek())) {
ParameterWebSocketRequest b = pendingMessages.poll();
a.merge(b);
}
CompletableFuture<WebSocketReplyData> future = yamcsClient.getWebSocketClient().sendRequest(a);
future.whenComplete((reply, exc) -> {
if (exc != null) {
log.log(Level.SEVERE, "Server exception while subscribing to parameters", exc);
} else {
try {
ParameterSubscriptionResponse response = ParameterSubscriptionResponse.parseFrom(reply.getData());
for (NamedObjectId id : response.getInvalidList()) {
log.fine("No parameter for id " + id);
}
} catch (InvalidProtocolBufferException e) {
log.log(Level.WARNING, "Failed to decode parameter subscription response", e);
}
}
});
}
}
Aggregations