Class RemoteEndpoint

    • Field Detail

      • DEFAULT_EXCEPTION_HANDLER

        public static final java.util.function.Function<java.lang.Throwable,​ResponseError> DEFAULT_EXCEPTION_HANDLER
    • Constructor Detail

      • RemoteEndpoint

        public RemoteEndpoint​(MessageConsumer out,
                              Endpoint localEndpoint,
                              java.util.function.Function<java.lang.Throwable,​ResponseError> exceptionHandler)
        Parameters:
        out - - a consumer that transmits messages to the remote service
        localEndpoint - - the local service implementation
        exceptionHandler - - an exception handler that should never return null.
      • RemoteEndpoint

        public RemoteEndpoint​(MessageConsumer out,
                              Endpoint localEndpoint)
        Parameters:
        out - - a consumer that transmits messages to the remote service
        localEndpoint - - the local service implementation
    • Method Detail

      • notify

        public void notify​(java.lang.String method,
                           java.lang.Object parameter)
        Send a notification to the remote endpoint.
        Specified by:
        notify in interface Endpoint
      • createNotificationMessage

        protected NotificationMessage createNotificationMessage​(java.lang.String method,
                                                                java.lang.Object parameter)
      • request

        public java.util.concurrent.CompletableFuture<java.lang.Object> request​(java.lang.String method,
                                                                                java.lang.Object parameter)
        Send a request to the remote endpoint.
        Specified by:
        request in interface Endpoint
      • createRequestMessage

        protected RequestMessage createRequestMessage​(java.lang.String method,
                                                      java.lang.Object parameter)
      • sendCancelNotification

        protected void sendCancelNotification​(Either<java.lang.String,​java.lang.Number> id)
      • handleResponse

        protected void handleResponse​(ResponseMessage responseMessage)
      • handleNotification

        protected void handleNotification​(NotificationMessage notificationMessage)
      • handleCancellation

        protected boolean handleCancellation​(NotificationMessage notificationMessage)
        Cancellation is handled inside this class and not forwarded to the local endpoint.
        Returns:
        true if the given message is a cancellation notification, false if it can be handled by the local endpoint
      • handleRequest

        protected void handleRequest​(RequestMessage requestMessage)
      • logIssues

        protected void logIssues​(Message message,
                                 java.util.List<MessageIssue> issues)
      • handleRequestIssues

        protected void handleRequestIssues​(RequestMessage requestMessage,
                                           java.util.List<MessageIssue> issues)
      • handleResponseIssues

        protected void handleResponseIssues​(ResponseMessage responseMessage,
                                            java.util.List<MessageIssue> issues)
      • createResultResponseMessage

        protected ResponseMessage createResultResponseMessage​(RequestMessage requestMessage,
                                                              java.lang.Object result)
      • isCancellation

        protected boolean isCancellation​(java.lang.Throwable t)
      • resolveMethod

        public java.lang.String resolveMethod​(java.lang.String requestId)
        Description copied from interface: MethodProvider
        Returns the method name for a given request id, or null if such request id is unknown.
        Specified by:
        resolveMethod in interface MethodProvider
        Returns:
        method name or null