gRPC is based on a client-server model of remote procedure calls. A client creates a channel which is connected to a server. RPCs are initiated from the client and sent to the server which then responds back to the client. When the client and server are done sending messages, they half close their respective connections. The RPC is complete as soon as the server closes.
To send an RPC, first create a io. using io.. When using auto generate Protobuf stubs, the stub class
will have constructors for wrapping the channel. These include newBlockingStub, newStub, and newFutureStub which you can use based on your design. The stub is the
primary way a client interacts with a server.
To receive RPCs, create a io. using io..
The Protobuf stub will contain an abstract class called AbstractFoo, where Foo is the name of
your service. Extend this class, and pass an instance of it to io.. Once your server is built, call io.
to begin accepting RPCs.
Both Clients and Servers should use a custom java.. The gRPC
runtime includes a default executor that eases testing and examples, but is not ideal for use in
a production environment. See the associated documentation in the respective builders.
Clients and Servers can also be shutdown gracefully using the shutdown method. The API
to conduct an orderly shutdown is modeled from the java..
gRPC also includes support for more advanced features, such as name resolution, load balancing, bidirectional streaming, health checking, and more. See the relative methods in the client and server builders.
Development of gRPC is done primary on Github at https://github.com/grpc/grpc-java, where the gRPC team welcomes contributions and bug reports. There is also a mailing list at grpc-io if you have questions about gRPC.
| Modifier and Type | Interface and Description |
|---|---|
| public interface | BindableService
Provides a way to bind instance of service implementation to server. |
| public interface | ClientInterceptor
Interface for intercepting outgoing calls before they are dispatched by a |
| public interface | Codec
Encloses classes related to the compression and decompression of messages. |
| public interface | Compressor
Represents a message compressor. |
| public interface | Decompressor
Represents a message decompressor. |
| public interface | Detachable
An extension of |
| public interface | Drainable
Extension to an |
| public interface | HasByteBuffer
Extension to an |
| public interface | |
| public interface | |
| public interface | InternalWithLogId
An internal class. |
| public interface | KnownLength
An |
| public interface | ProxyDetector
A utility class to detect which proxy, if any, should be used for a given
|
| public interface | ServerCallExecutorSupplier
Defines what executor handles the server call, based on each RPC call information at runtime. |
| public interface | |
| public interface | ServerInterceptor
Interface for intercepting incoming calls before that are dispatched by
|
| Modifier and Type | Annotation and Description |
|---|---|
| public @interface | ExperimentalApi
Indicates a public API that can change at any time, and has no guarantee of API stability and backward-compatibility. |
| public @interface | Internal
Annotates a program element (class, method, package, etc) which is internal to gRPC, not part of the public API, and should not be used by users of gRPC. |
| Modifier and Type | Class and Description |
|---|---|
| public class | Attributes
An immutable type-safe container of attributes. |
| public abstract class | BinaryLog
A binary log that can be installed on a channel or server. |
| public abstract class | CallCredentials
Carries credential data that will be propagated to the server via request metadata for each RPC. |
| public class | CallOptions
The collection of runtime options for a new RPC call. |
| public abstract class | Channel
A virtual connection to a conceptual endpoint, to perform RPCs. |
| public abstract class | ChannelCredentials
Represents a security configuration to be used for channels. |
| public abstract class | ChannelLogger
A Channel-specific logger provided by GRPC library to |
| public class | ChoiceChannelCredentials
Provides a list of |
| public class | ChoiceServerCredentials
Provides a list of |
| public abstract class | ClientCall<
type of message sent one or more times to the server. ReqT, type of message received one or more times from the server. RespT>An instance of a call to a remote method. |
| public class | ClientInterceptors
Utility methods for working with |
| public abstract class | ClientStreamTracer
|
| public class | CompositeCallCredentials
Uses multiple |
| public class | CompositeChannelCredentials
|
| public class | CompressorRegistry
Encloses classes related to the compression and decompression of messages. |
| public class | ConnectivityStateInfo
A tuple of a |
| public class | Context
A context propagation mechanism which can carry scoped-values across API boundaries and between threads. |
| public class | |
| public class | Deadline
An absolute point in time, generally for tracking when a task should be completed. |
| public class | DecompressorRegistry
Encloses classes related to the compression and decompression of messages. |
| public class | EquivalentAddressGroup
A group of |
| public abstract class | ForwardingChannelBuilder<
The type of the subclass extending this abstract class. T extends ForwardingChannelBuilderA |
| public abstract class | ForwardingChannelBuilder2<
The type of the subclass extending this abstract class. T extends ManagedChannelBuilderA |
| public abstract class | ForwardingClientCall<ReqT, RespT>
A |
| public abstract class | ForwardingClientCallListener<RespT>
A |
| public abstract class | ForwardingServerBuilder<
The type of the subclass extending this abstract class. T extends ServerBuilderA |
| public abstract class | ForwardingServerCall<ReqT, RespT>
A |
| public abstract class | ForwardingServerCallListener<ReqT>
A |
| pack-priv class | GlobalInterceptors
The collection of global interceptors and global server stream tracers. |
| public class | Grpc
Stuff that are part of the public API but are not bound to particular classes, e.g., static methods, constants, attribute and context keys. |
| public abstract class | HandlerRegistry
Registry of services and their methods used by servers to dispatching incoming calls. |
| public class | HttpConnectProxiedSocketAddress
An |
| public class | InsecureChannelCredentials
No client identity, authentication, or encryption is to be used. |
| public class | InsecureServerCredentials
No server identity or encryption is to be used. |
| public class | InternalCallOptions
Internal accessor for |
| public class | InternalChannelz
This is an internal API. |
| public class | InternalClientInterceptors
Internal accessor. |
| public abstract class | InternalConfigSelector
Per method config selector that the channel or load balancers will use to choose the appropriate config or take config related actions for an RPC. |
| public class | InternalDecompressorRegistry
Private accessor for decompressor registries. |
| public class | InternalGlobalInterceptors
Accessor to internal methods of |
| public class | InternalLogId
An internal class. |
| public class | InternalManagedChannelProvider
Internal accessor for |
| public class | InternalMetadata
Internal |
| public class | InternalMethodDescriptor
Accesses internal data and methods. |
| public class | InternalServer
Internal accessor for getting the |
| public class | InternalServerInterceptors
Accessor to internal methods of |
| public class | InternalServerProvider
Internal accessor for |
| public class | |
| public class | InternalStatus
Accesses internal data. |
| public abstract class | LoadBalancer
A pluggable component that receives resolved addresses from |
| public abstract class | LoadBalancerProvider
Provider of |
| public class | LoadBalancerRegistry
Registry of |
| public abstract class | ManagedChannel
A |
| public abstract class | ManagedChannelBuilder<
The concrete type of this builder. T extends ManagedChannelBuilderA builder for |
| public abstract class | ManagedChannelProvider
Provider of managed channels for transport agnostic consumption. |
| public class | ManagedChannelRegistry
Registry of |
| public class | Metadata
Provides access to read and write metadata values to be exchanged during a call. |
| public class | |
| public abstract class | NameResolver
A pluggable component that resolves a target |
| public abstract class | NameResolverProvider
Provider of name resolvers for name agnostic consumption. |
| public class | NameResolverRegistry
Registry of |
| pack-priv abstract class | PartialForwardingClientCall<ReqT, RespT>
A |
| pack-priv abstract class | PartialForwardingClientCallListener<RespT>
A |
| pack-priv abstract class | PartialForwardingServerCall<ReqT, RespT>
A |
| pack-priv abstract class | PartialForwardingServerCallListener<ReqT>
A |
| pack-priv class | PersistentHashArrayMappedTrie
A persistent (copy-on-write) hash tree/trie. |
| public abstract class | ProxiedSocketAddress
An address that contains the information about making a connection via a proxy. |
| public abstract class | Server
Server for listening for and dispatching incoming calls. |
| public abstract class | ServerBuilder<
The concrete type of this builder. T extends ServerBuilderA builder for |
| public abstract class | ServerCall<
parsed type of request message. ReqT, parsed type of response message. RespT>Encapsulates a single call received from a remote client. |
| public abstract class | ServerCredentials
Represents a security configuration to be used for servers. |
| public class | ServerInterceptors
Utility methods for working with |
| public class | |
| public abstract class | ServerProvider
Provider of servers for transport agnostic consumption. |
| public class | ServerRegistry
Registry of |
| public class | ServerServiceDefinition
Definition of a service to be exposed via a Server. |
| public abstract class | ServerStreamTracer
Listens to events on a stream to collect metrics. |
| public abstract class | ServerTransportFilter
Listens on server transport life-cycle events, with the capability to read and/or change transport attributes. |
| public class | ServiceDescriptor
Descriptor for a service. |
| pack-priv class | |
| public class | |
| public class | StatusException
|
| public class | StatusRuntimeException
|
| public abstract class | StreamTracer
Listens to events on a stream to collect metrics. |
| public class | SynchronizationContext
A synchronization context is a queue of tasks that run in sequence. |
| pack-priv class | ThreadLocalContextStorage
A |
| public class | TlsChannelCredentials
TLS credentials, providing server authentication and encryption. |
| public class | TlsServerCredentials
TLS credentials, providing server identity and encryption. |
| Modifier and Type | Enum and Description |
|---|---|
| public enum | ConnectivityState
The connectivity states. |
| public enum | InternalKnownTransport
All known transports. |
| public enum | SecurityLevel
The level of security guarantee in communications. |