Class RpcMethod<Req,Resp>
- Type Parameters:
Req- тип запроса / request typeResp- тип ответа / response type
RpcChannel.
Optional typed method facade on top of the low-level RpcChannel
API.
Этот класс не меняет поведение core transport-а. Это тонкая convenience wrapper-обёртка, которая оставляет снизу тот же raw путь через messageTypeId и codec.
This class does not change the core transport behavior. It is a thin convenience wrapper that keeps the raw message-type and codec path available underneath.
-
Method Summary
Modifier and TypeMethodDescriptioncall(RpcChannel channel, Req request) Вызывает метод через указанный канал с default timeout канала.call(RpcChannel channel, Req request, long timeout, TimeUnit unit) Вызывает метод через указанный канал с явным timeout.static <Req,Resp> RpcMethod <Req, Resp> of(int requestMessageTypeId, int responseMessageTypeId, MessageCodec<Req> requestCodec, MessageCodec<Resp> responseCodec) Создаёт typed-описание одного RPC метода.voidregister(RpcChannel channel, RequestHandler<Req, Resp> handler) Регистрирует handler этого метода на указанном канале.Возвращает codec запроса.intВозвращает messageTypeId запроса.Возвращает codec ответа.intВозвращает messageTypeId ответа.
-
Method Details
-
of
public static <Req,Resp> RpcMethod<Req,Resp> of(int requestMessageTypeId, int responseMessageTypeId, MessageCodec<Req> requestCodec, MessageCodec<Resp> responseCodec) Создаёт typed-описание одного RPC метода.Creates a typed description of one RPC method.
- Type Parameters:
Req- request typeResp- response type- Parameters:
requestMessageTypeId- request message type idresponseMessageTypeId- response message type idrequestCodec- request codecresponseCodec- response codec- Returns:
- typed method descriptor
-
register
Регистрирует handler этого метода на указанном канале.Registers this method's handler on the provided channel.
- Parameters:
channel- channel to register onhandler- typed request handler
-
call
Вызывает метод через указанный канал с default timeout канала.Calls the method through the provided channel using the channel default timeout.
- Parameters:
channel- channel used for the callrequest- request payload- Returns:
- decoded response
-
call
Вызывает метод через указанный канал с явным timeout.Calls the method through the provided channel using an explicit timeout.
- Parameters:
channel- channel used for the callrequest- request payloadtimeout- timeout valueunit- timeout unit- Returns:
- decoded response
-
requestMessageTypeId
public int requestMessageTypeId()Возвращает messageTypeId запроса.Returns the request message type id.
- Returns:
- request message type id
-
responseMessageTypeId
public int responseMessageTypeId()Возвращает messageTypeId ответа.Returns the response message type id.
- Returns:
- response message type id
-
requestCodec
Возвращает codec запроса.Returns the request codec.
- Returns:
- request codec
-
responseCodec
Возвращает codec ответа.Returns the response codec.
- Returns:
- response codec
-