Top Description Interfaces Annotations Classes Enums
[default module]

Package io.grpc


The gRPC core public API.

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.grpc.Channel using io.grpc.ManagedChannelBuilder#forTarget. 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.grpc.Server using io.grpc.ServerBuilder#forPort. 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.grpc.ServerBuilder#addService. Once your server is built, call io.grpc.Server#start to begin accepting RPCs.

Both Clients and Servers should use a custom java.util.concurrent.Executor. 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.util.concurrent.ExecutorService.

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.

Interface Summary

Modifier and TypeInterface 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 Channel.

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 InputStream that allows the underlying data source to be detached and transferred to a new instance of the same kind.

public interface
Drainable

Extension to an java.io.InputStream or alike by adding a method that transfers all content to an OutputStream.

public interface
HasByteBuffer

Extension to an java.io.InputStream whose content can be accessed as ByteBuffers.

public interface
InternalInstrumented<T>

An internal class.

public interface
public interface
InternalWithLogId

An internal class.

public interface
KnownLength

An java.io.InputStream or alike whose total number of bytes that can be read is known upfront.

public interface
ProxyDetector

A utility class to detect which proxy, if any, should be used for a given java.net.SocketAddress.

public interface
ServerCallExecutorSupplier

Defines what executor handles the server call, based on each RPC call information at runtime.

public interface
ServerCallHandler<RequestT, ResponseT>

Interface to initiate processing of incoming remote calls.

public interface
ServerInterceptor

Interface for intercepting incoming calls before that are dispatched by ServerCallHandler.

Annotation Summary

Modifier and TypeAnnotation 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.

Class Summary

Modifier and TypeClass 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 LoadBalancer implementations.

public class
ChoiceChannelCredentials

Provides a list of ChannelCredentials, where any one may be used.

public class
ChoiceServerCredentials

Provides a list of ServerCredentials, where any one may be used.

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 ClientInterceptors.

public abstract class
ClientStreamTracer

StreamTracer for the client-side.

public class
CompositeCallCredentials

Uses multiple CallCredentials as if they were one.

public class
CompositeChannelCredentials

ChannelCredentials which use per-RPC CallCredentials.

public class
CompressorRegistry

Encloses classes related to the compression and decompression of messages.

public class
ConnectivityStateInfo

A tuple of a ConnectivityState and its associated Status.

public class
Context

A context propagation mechanism which can carry scoped-values across API boundaries and between threads.

public class
Contexts

Utility methods for working with Contexts in GRPC.

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 SocketAddresses that are considered equivalent when channel makes connections.

public abstract class
ForwardingChannelBuilder<
The type of the subclass extending this abstract class.
T extends ForwardingChannelBuilder<T>
>

A ManagedChannelBuilder that delegates all its builder methods to another builder by default.

public abstract class
ForwardingChannelBuilder2<
The type of the subclass extending this abstract class.
T extends ManagedChannelBuilder<T>
>

A ManagedChannelBuilder that delegates all its builder methods to another builder by default.

public abstract class
ForwardingClientCall<ReqT, RespT>

A ClientCall which forwards all of its methods to another ClientCall.

public abstract class
ForwardingClientCallListener<RespT>

A ClientCall.Listener which forwards all of its methods to another ClientCall.Listener.

public abstract class
ForwardingServerBuilder<
The type of the subclass extending this abstract class.
T extends ServerBuilder<T>
>

A ServerBuilder that delegates all its builder methods to another builder by default.

public abstract class
ForwardingServerCall<ReqT, RespT>

A ServerCall which forwards all of its methods to another ServerCall.

public abstract class
ForwardingServerCallListener<ReqT>

A ServerCall.Listener which forwards all of its methods to another ServerCall.Listener of matching parameterized types.

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 ProxiedSocketAddress for making a connection to an endpoint via an HTTP CONNECT proxy.

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 CallOptions.

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 GlobalInterceptors.

public class
InternalLogId

An internal class.

public class
public class
InternalMetadata

Internal Metadata accessor.

public class
InternalMethodDescriptor

Accesses internal data and methods.

public class
InternalServer

Internal accessor for getting the Server instance inside server RPC Context.

public class
InternalServerInterceptors

Accessor to internal methods of ServerInterceptors.

public class
InternalServerProvider

Internal accessor for ServerProvider.

public class
public class
InternalStatus

Accesses internal data.

public abstract class
LoadBalancer

A pluggable component that receives resolved addresses from NameResolver and provides the channel a usable subchannel when asked.

public abstract class
public class
public abstract class
ManagedChannel

A Channel that provides lifecycle management.

public abstract class
ManagedChannelBuilder<
The concrete type of this builder.
T extends ManagedChannelBuilder<T>
>

A builder for ManagedChannel instances.

public abstract class
ManagedChannelProvider

Provider of managed channels for transport agnostic consumption.

public class
public class
Metadata

Provides access to read and write metadata values to be exchanged during a call.

public class
MethodDescriptor<ReqT, RespT>

Description of a remote method used by Channel to initiate a call.

public abstract class
NameResolver

A pluggable component that resolves a target URI and return addresses to the caller.

public abstract class
NameResolverProvider

Provider of name resolvers for name agnostic consumption.

public class
pack-priv abstract class
PartialForwardingClientCall<ReqT, RespT>

A ClientCall which forwards all of its methods to another ClientCall which may have a different sendMessage() message type.

pack-priv abstract class
PartialForwardingClientCallListener<RespT>

A ClientCall.Listener which forwards all of its methods to another ClientCall.Listener which may have a different parameterized type than the onMessage() message type.

pack-priv abstract class
PartialForwardingServerCall<ReqT, RespT>

A ServerCall which forwards all of it's methods to another ServerCall which may have a different sendMessage() message type.

pack-priv abstract class
PartialForwardingServerCallListener<ReqT>

A ServerCall.Listener which forwards all of its methods to another ServerCall.Listener which may have a different parameterized type than the onMessage() message type.

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 ServerBuilder<T>
>

A builder for Server instances.

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 ServerInterceptors.

public class
ServerMethodDefinition<ReqT, RespT>

Definition of a method exposed by a Server.

public abstract class
ServerProvider

Provider of servers for transport agnostic consumption.

public class
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
Status

Defines the status of an operation by providing a standard Code in conjunction with an optional descriptive message.

public class
StatusException

Status in Exception form, for propagating Status information via exceptions.

public class
StatusRuntimeException

Status in RuntimeException form, for propagating Status information via exceptions.

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 ThreadLocal-based context storage implementation.

public class
TlsChannelCredentials

TLS credentials, providing server authentication and encryption.

public class
TlsServerCredentials

TLS credentials, providing server identity and encryption.

Enum Summary

Modifier and TypeEnum and Description
public enum
ConnectivityState

The connectivity states.

public enum
InternalKnownTransport

All known transports.

public enum
SecurityLevel

The level of security guarantee in communications.