Search in sources :

Example 1 with RepublishResponse

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);
}
Also used : ResponseHeader(org.eclipse.milo.opcua.stack.core.types.structured.ResponseHeader) NotificationMessage(org.eclipse.milo.opcua.stack.core.types.structured.NotificationMessage) UInteger(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger) RepublishResponse(org.eclipse.milo.opcua.stack.core.types.structured.RepublishResponse) RepublishRequest(org.eclipse.milo.opcua.stack.core.types.structured.RepublishRequest)

Aggregations

UInteger (org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger)1 NotificationMessage (org.eclipse.milo.opcua.stack.core.types.structured.NotificationMessage)1 RepublishRequest (org.eclipse.milo.opcua.stack.core.types.structured.RepublishRequest)1 RepublishResponse (org.eclipse.milo.opcua.stack.core.types.structured.RepublishResponse)1 ResponseHeader (org.eclipse.milo.opcua.stack.core.types.structured.ResponseHeader)1