@Immutable public class MethodDescriptor<RequestT,ResponseT> extends Object
Channel
to initiate a call.
Provides the name of the operation to execute as well as Marshaller
instances
used to parse and serialize request and response messages.
Can be constructed manually but will often be generated by stub code generators.
Modifier and Type | Method and Description |
---|---|
static <RequestT,ResponseT> |
create(MethodType type,
String name,
long timeout,
TimeUnit timeoutUnit,
Marshaller<RequestT> requestMarshaller,
Marshaller<ResponseT> responseMarshaller) |
String |
getName()
The fully qualified name of the method.
|
long |
getTimeout()
Timeout for the operation in microseconds.
|
MethodType |
getType()
The call type of the method.
|
ResponseT |
parseResponse(InputStream input)
Parse a response payload from the given
InputStream . |
InputStream |
streamRequest(RequestT requestMessage)
Convert a request message to an
InputStream . |
MethodDescriptor<RequestT,ResponseT> |
withTimeout(long timeout,
TimeUnit unit)
Create a new descriptor with a different timeout.
|
public static <RequestT,ResponseT> MethodDescriptor<RequestT,ResponseT> create(MethodType type, String name, long timeout, TimeUnit timeoutUnit, Marshaller<RequestT> requestMarshaller, Marshaller<ResponseT> responseMarshaller)
public MethodType getType()
public String getName()
public long getTimeout()
public ResponseT parseResponse(InputStream input)
InputStream
.input
- stream containing response message to parse.public InputStream streamRequest(RequestT requestMessage)
InputStream
.requestMessage
- to serialize using the request Marshaller
.public MethodDescriptor<RequestT,ResponseT> withTimeout(long timeout, TimeUnit unit)
timeout
- to set on cloned descriptor.unit
- of time for timeout
.