- Object
-
- MessageResponse
-
public class MessageResponse extends Object
Response message sent to the client
-
-
Constructor Summary
Constructors Constructor Description MessageResponse(ByteBuffer message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Consumer<Throwable>>
getErrorHandler()
Return error handler if anyByteBuffer
getMessage()
Message responseboolean
shouldCloseOnResponse()
Return whetherwithCloseOnResponse()
is set or notboolean
shouldIgnoreNextRequest()
Return whetherwithIgnoreNextRequest()
is set or notMessageResponse
withCloseOnResponse()
Close the connection after response is sent.MessageResponse
withErrorHandler(Consumer<Throwable> errorHandler)
Set up error handler which will be called in case of an error delivering the message response to the client.MessageResponse
withIgnoreNextRequest()
By default every time your service provides a *response* message, ICE sends it back to the client and waits for the next *request* message from it (see ICE looper description).
-
-
-
Method Detail
-
withCloseOnResponse
public MessageResponse withCloseOnResponse()
Close the connection after response is sent.
-
withIgnoreNextRequest
public MessageResponse withIgnoreNextRequest()
By default every time your service provides a *response* message, ICE sends it back to the client and waits for the next *request* message from it (see ICE looper description).
With this flag set ICE will not wait for next request from the client instead it will proceed to
MessageService
for another message which needs to be send to the client.You may want to use it when you need your service to send stream of messages.
-
withErrorHandler
public MessageResponse withErrorHandler(Consumer<Throwable> errorHandler)
Set up error handler which will be called in case of an error delivering the message response to the client.
-
getMessage
public ByteBuffer getMessage()
Message response
-
shouldCloseOnResponse
public boolean shouldCloseOnResponse()
Return whetherwithCloseOnResponse()
is set or not
-
shouldIgnoreNextRequest
public boolean shouldIgnoreNextRequest()
Return whetherwithIgnoreNextRequest()
is set or not
-
getErrorHandler
public Optional<Consumer<Throwable>> getErrorHandler()
Return error handler if any
-
-