public interface IClientRouter
Created by mwei on 12/13/15.
Modifier and Type | Method and Description |
---|---|
IClientRouter |
addClient(IClient client)
Add a new client to the router.
|
void |
completeExceptionally(long requestID,
Throwable cause)
Exceptionally complete a request with a given cause.
|
<T> void |
completeRequest(long requestID,
T completion)
Complete a given outstanding request with a completion value.
|
<T extends IClient> |
getClient(Class<T> clientType)
Gets a client that matches a particular type.
|
String |
getHost()
The host that this router is routing requests for.
|
Integer |
getPort()
The port that this router is routing requests for.
|
void |
sendMessage(io.netty.channel.ChannelHandlerContext ctx,
CorfuMsg message)
Send a one way message, without adding a completable future.
|
default void |
sendMessage(CorfuMsg message)
Send a one way message using the default channel handler,
without adding a completable future.
|
<T> CompletableFuture<T> |
sendMessageAndGetCompletable(io.netty.channel.ChannelHandlerContext ctx,
CorfuMsg message)
Send a message and get a completable future to be fulfilled by the reply.
|
default <T> CompletableFuture<T> |
sendMessageAndGetCompletable(CorfuMsg message)
Send a message using the router channel handler and
get a completable future to be fulfilled by the reply.
|
void |
sendResponseToServer(io.netty.channel.ChannelHandlerContext ctx,
CorfuMsg inMsg,
CorfuMsg outMsg)
Send a netty message through this router, setting the fields in the outgoing message.
|
void |
setTimeoutConnect(long timeoutConnect)
Set the Connect timeout
|
void |
setTimeoutResponse(long timeoutResponse)
Set the Response timeout
|
void |
setTimeoutRetry(long timeoutRetry)
Set the retry timeout
|
void |
start()
Starts routing requests.
|
void |
stop()
Stops routing requests.
|
void |
stop(boolean shutdown) |
IClientRouter addClient(IClient client)
client
- The client to add to the router.<T extends IClient> T getClient(Class<T> clientType)
T
- The type of the client to match.clientType
- The class of the client to match.NoSuchElementException
- If there are no clients matching that type.<T> CompletableFuture<T> sendMessageAndGetCompletable(io.netty.channel.ChannelHandlerContext ctx, CorfuMsg message)
T
- The type of completable to return.ctx
- The channel handler context to send the message under.message
- The message to send.default <T> CompletableFuture<T> sendMessageAndGetCompletable(CorfuMsg message)
T
- The type of completable to return.message
- The message to send.void sendMessage(io.netty.channel.ChannelHandlerContext ctx, CorfuMsg message)
ctx
- The context to send the message under.message
- The message to send.default void sendMessage(CorfuMsg message)
message
- The message to send.void sendResponseToServer(io.netty.channel.ChannelHandlerContext ctx, CorfuMsg inMsg, CorfuMsg outMsg)
ctx
- Channel handler context to use.inMsg
- Incoming message to respond to.outMsg
- Outgoing message.<T> void completeRequest(long requestID, T completion)
T
- The type of the completion.requestID
- The request to complete.completion
- The value to complete the request withvoid completeExceptionally(long requestID, Throwable cause)
requestID
- The request to complete.cause
- The cause to give for the exceptional completion.void start()
void stop()
void stop(boolean shutdown)
String getHost()
Integer getPort()
void setTimeoutConnect(long timeoutConnect)
timeoutConnect
- timeout for connection in milliseconds.void setTimeoutRetry(long timeoutRetry)
timeoutRetry
- timeout to make a retry in milliseconds.void setTimeoutResponse(long timeoutResponse)
timeoutResponse
- Response timeout in milliseconds.Copyright © 2019 CorfuDB. All rights reserved.