Interface Request

All Superinterfaces:
Messageable
All Known Subinterfaces:
RequestWrapper
All Known Implementing Classes:
ClusterRequest, EmptyRequest, RequestMock.ClusterRequestMock, RestRequest, TcpRequest, UdpRequest, WebsocketRequest

public interface Request extends Messageable
Base request class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Accepts the request indicating that it was processed successfully but that there is no response.
     
    io.vertx.core.json.JsonObject
    Get the raw data of the request as a json object
    default void
    error​(Throwable exception)
    Write an error and code to the response.
    default int
    default void
    result​(io.vertx.core.AsyncResult<?> event)
    Convenience method that converts the request to a future.
    default String
    Get the route from the request, the route specifies with method that should be invoked.
    int
     
    default String
    The target node of the request.
    default int
    Get the request timeout which indicates how long the sender is waiting until the request is considered to have timed out.
    default Token
    Get the request token sent with the request.

    Methods inherited from interface com.codingchili.core.listener.Messageable

    write
  • Field Details

  • Method Details

    • route

      default String route()
      Get the route from the request, the route specifies with method that should be invoked.
      Returns:
      the requested route
    • accept

      default void accept()
      Accepts the request indicating that it was processed successfully but that there is no response.
    • result

      default void result(io.vertx.core.AsyncResult<?> event)
      Convenience method that converts the request to a future. - if the future fails: Request::error is called with the cause - if the future completes with null: Request::accept is called - if the future completed with value: Request::write is called
      Parameters:
      event - an event to be converted into a result that can be written to a request.
    • error

      default void error(Throwable exception)
      Write an error and code to the response.
      Parameters:
      exception - the exception that caused the error.
    • target

      default String target()
      The target node of the request. The target specifies which service or which sub-service that the requested route resides in.
      Returns:
      the target node
    • token

      default Token token()
      Get the request token sent with the request.
      Returns:
      the requests token
    • connection

      Connection connection()
      Returns:
      the underlying connection of the request, may be called multiple times per request returning the same connection object.
    • data

      io.vertx.core.json.JsonObject data()
      Get the raw data of the request as a json object
      Returns:
      the raw data of the request
    • timeout

      default int timeout()
      Get the request timeout which indicates how long the sender is waiting until the request is considered to have timed out.

      defaults to #ListenerSettings.DEFAULT_TIMEOUT

      Returns:
      milliseconds specifying the timeout of the request
    • size

      int size()
      Returns:
      the size of the request in bytes.
    • maxSize

      default int maxSize()
      Returns:
      the maximum number of bytes allowed in a single request.