Package com.codingchili.core.listener
Interface Request
- All Superinterfaces:
Messageable
- All Known Subinterfaces:
RequestWrapper
- All Known Implementing Classes:
ClusterRequest
,EmptyRequest
,RequestMock.ClusterRequestMock
,RestRequest
,TcpRequest
,UdpRequest
,WebsocketRequest
Base request class.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
accept()
Accepts the request indicating that it was processed successfully but that there is no response.io.vertx.core.json.JsonObject
data()
Get the raw data of the request as a json objectdefault void
Write an error and code to the response.default int
maxSize()
defaults to #ListenerSettings.DEFAULT_MAX_REQUEST_BYTES
default void
result(io.vertx.core.AsyncResult<?> event)
Convenience method that converts the request to a future.default String
route()
Get the route from the request, the route specifies with method that should be invoked.int
size()
default String
target()
The target node of the request.default int
timeout()
Get the request timeout which indicates how long the sender is waiting until the request is considered to have timed out.default Token
token()
Get the request token sent with the request.Methods inherited from interface com.codingchili.core.listener.Messageable
write
-
Field Details
-
TARGET_UNDEFINED
- See Also:
- Constant Field Values
-
-
Method Details
-
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
Write an error and code to the response.- Parameters:
exception
- the exception that caused the error.
-
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
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()defaults to #ListenerSettings.DEFAULT_MAX_REQUEST_BYTES
- Returns:
- the maximum number of bytes allowed in a single request.
-