Package io.grpc
Class Channel
java.lang.Object
io.grpc.Channel
- Direct Known Subclasses:
ManagedChannel
A virtual connection to a conceptual endpoint, to perform RPCs. A channel is free to have zero or
many actual connections to the endpoint based on configuration, load, etc. A channel is also free
to determine which actual endpoints to use and may change it every RPC, permitting client-side
load balancing. Applications are generally expected to use stubs instead of calling this class
directly.
Applications can add common cross-cutting behaviors to stubs by decorating Channel
implementations using ClientInterceptor
. It is expected that most application
code will not use this class directly but rather work with stubs that have been bound to a
Channel that was decorated during application initialization.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract String
The authority of the destination this channel connects to.abstract <RequestT,
ResponseT>
ClientCall<RequestT, ResponseT> newCall
(MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) Create aClientCall
to the remote operation specified by the givenMethodDescriptor
.
-
Constructor Details
-
Channel
public Channel()
-
-
Method Details
-
newCall
public abstract <RequestT,ResponseT> ClientCall<RequestT,ResponseT> newCall(MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) Create aClientCall
to the remote operation specified by the givenMethodDescriptor
. The returnedClientCall
does not trigger any remote behavior untilClientCall.start(ClientCall.Listener, Metadata)
is invoked.- Parameters:
methodDescriptor
- describes the name and parameter types of the operation to call.callOptions
- runtime options to be applied to this call.- Returns:
- a
ClientCall
bound to the specified method. - Since:
- 1.0.0
-
authority
The authority of the destination this channel connects to. Typically this is in the formathost:port
.- Since:
- 1.0.0
-