use of org.eclipse.milo.opcua.stack.core.types.structured.RepublishResponse in project milo by eclipse.
the class SubscriptionManager method republish.
public void republish(ServiceRequest service) {
RepublishRequest request = (RepublishRequest) service.getRequest();
if (subscriptions.isEmpty()) {
service.setServiceFault(StatusCodes.Bad_SubscriptionIdInvalid);
return;
}
UInteger subscriptionId = request.getSubscriptionId();
Subscription subscription = subscriptions.get(subscriptionId);
if (subscription == null) {
service.setServiceFault(StatusCodes.Bad_SubscriptionIdInvalid);
return;
}
UInteger sequenceNumber = request.getRetransmitSequenceNumber();
NotificationMessage notificationMessage = subscription.republish(sequenceNumber);
if (notificationMessage == null) {
service.setServiceFault(StatusCodes.Bad_MessageNotAvailable);
return;
}
ResponseHeader header = service.createResponseHeader();
RepublishResponse response = new RepublishResponse(header, notificationMessage);
service.setResponse(response);
}
Aggregations