Interface Request<R extends Response>

    • Method Detail

      • id

        long id()
        Holds a unique ID for each request that is assigned automatically.
        Returns:
        the unique request ID.
      • response

        CompletableFuture<R> response()
        Holds the response which eventually completes.
        Returns:
        the future containing the response, eventually.
      • succeed

        void succeed​(R result)
        Completes this request successfully.
        Parameters:
        result - the result to complete with.
      • fail

        void fail​(Throwable error)
        Fails this request and completes it.
        Parameters:
        error - the error to fail this request with.
      • context

        RequestContext context()
        If attached, returns the context for this request.
        Returns:
        the request context if attached.
      • timeout

        Duration timeout()
        Returns the timeout for this rquest.
        Returns:
        the timeout for this request.
      • completed

        boolean completed()
        Allows to check if this request is completed already.
        Returns:
        true if completed, failed or cancelled.
      • succeeded

        boolean succeeded()
        Allows to check if this request has been successfully completed.
        Returns:
        true if succeeded, false otherwise.
      • failed

        boolean failed()
        Allows to check if this request has been completed but with an exception.
        Returns:
        true if failed, false otherwise.
      • cancelled

        boolean cancelled()
        Allows to check if this request has been cancelled before it got a chance to be either failed or succeeded.
        Returns:
        true if cancelled, false otherwise.
      • cancellationReason

        CancellationReason cancellationReason()
        If the request is cancelled(), this returns the reason why.
        Returns:
        the cancellation reason if cancelled, null otherwise.
      • serviceType

        ServiceType serviceType()
        The service type of this request.
        Returns:
        the service type for this request.
      • serviceContext

        Map<String,​Object> serviceContext()
        Returns contextual information for each individual service.
        Returns:
        the service context.
      • retryStrategy

        RetryStrategy retryStrategy()
        The retry strategy for this particular request.
        Returns:
        the retry strategy for this request.