Modules
Module grpc
API
Declarations
Definitions

ballerina/grpc Ballerina library
Functions
authenticateResource
function authenticateResource(Service serviceRef)
Uses for declarative auth design, where the authentication/authorization decision is taken
by reading the auth annotations provided in service/resource and the Authorization
header of request.
Parameters
- serviceRef Service - The service reference where the resource locates
getDeadline
Returns the deadline value as time:Utc
. This can be used to get the deadline and propagate it to subsequent internal calls.
time:Utc?|time:Error deadline = grpc:getDeadline(map<string|string[]> headerMap);
Return Type
- Utc?|Error -
deadline
value when the deadline is correctly specified,()
when the deadline is not specified, or else atime:Error
when adeadline
-parsing error occurred
getHeader
Returns the header value with the specified header name. If there are more than one header values for the specified header name, the first value is returned.
map<string|string[]> headerMap = request.headers; string|grpc:Error result = grpc:getHeader(headerMap, "content-type");
Parameters
- headerName string - The header name
getHeaders
Gets all the transport headers with the specified header name.
map<string|string[]> headerMap = request.headers; string[]|grpc:Error result = grpc:getHeaders(headerMap, "content-type");
Parameters
- headerName string - The header name
isCancelled
Checks whether the deadline is already exceeded or not.
boolean|time:Error isCancelled = grpc:isCancelled(map<string|string[]> headerMap);
Return Type
- boolean|Error -
true
when the deadline is exceeded,false
when the deadline is not exceeded, or else atime:Error
when adeadline
-parsing error occurred
setCompression
function setCompression(CompressionType compressionType, map<string|string[]> headerMap) returns map<string|string[]>
Enables the compression support by adding the grpc-encoding
header to the given headers.
map<string|string[]> headers = grpc:setCompression(grpc:GZIP);
Parameters
- compressionType CompressionType - The compression type.
setDeadline
Enables the deadline by adding the deadline
header to the given headers.
time:Utc current = time:utcNow(); time:Utc deadline = time:utcAddSeconds(current, 300); map<string|string[]> headers = grpc:setDeadline(deadline);
Parameters
- deadline Utc - The deadline time value (this should be a specific time and not a duration)
Classes
grpc: ClientBasicAuthHandler
Defines the Basic Auth handler for client authentication.
Constructor
Initializes the Basic Auth handler for client authentication.
init (CredentialsConfig config)
- config CredentialsConfig - The Basic Auth credentials
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The updated
map<string|string[]>
headers map instance or else agrpc:ClientAuthError
in case of an error
grpc: ClientBearerTokenAuthHandler
Defines the Bearer token auth handler for client authentication.
Constructor
Initializes the Bearer token auth handler for client authentication.
init (BearerTokenConfig config)
- config BearerTokenConfig - The Bearer token
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The Bearer token as a
string
or else agrpc:ClientAuthError
in case of an error
grpc: ClientSelfSignedJwtAuthHandler
Defines the self signed JWT handler for client authentication.
Constructor
Initializes the self-signed JWT handler for client authentication.
init (JwtIssuerConfig config)
- config JwtIssuerConfig - JWT issuer configurations
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The updated
map<string|string[]>
headers map instance or else agrpc:ClientAuthError
in case of an error
grpc: ListenerFileUserStoreBasicAuthHandler
Defines the file store Basic Auth handler for listener authentication.
Constructor
Initializes the grpc:ListenerFileUserStoreBasicAuthHandler
object.
init (FileUserStoreConfig config)
- config FileUserStoreConfig {} - The
grpc:FileUserStoreConfig
instance
authenticate
function authenticate(map<string|string[]> headers) returns UserDetails|UnauthenticatedError
Authenticates with the relevant authentication requirements.
Return Type
- UserDetails|UnauthenticatedError - The
auth:UserDetails
instance or else anUnauthenticatedError
error
authorize
function authorize(UserDetails userDetails, string|string[] expectedScopes) returns PermissionDeniedError?
Authorizes with the relevant authorization requirements.
Parameters
- userDetails UserDetails - The
auth:UserDetails
instance which is received from authentication results
Return Type
- PermissionDeniedError? -
()
, if it is successful or else aPermissionDeniedError
error
grpc: ListenerJwtAuthHandler
Defines the JWT auth handler for listener authentication.
Constructor
Initializes the JWT auth handler for the listener authentication.
init (JwtValidatorConfig config)
- config JwtValidatorConfig - JWT validator configurations
authenticate
function authenticate(map<string|string[]> headers) returns Payload|UnauthenticatedError
Authenticates with the relevant authentication requirements.
Return Type
- Payload|UnauthenticatedError - The
jwt:Payload
instance or else angrpc:UnauthenticatedError
error
authorize
function authorize(Payload jwtPayload, string|string[] expectedScopes) returns PermissionDeniedError?
Authorizes with the relevant authorization requirements.
Parameters
- jwtPayload Payload - The
jwt:Payload
instance which is received from authentication results
Return Type
- PermissionDeniedError? -
()
, if it is successful or else agrpc:PermissionDeniedError
error
Clients
grpc: Caller
The base client used in the generated client code to provide remote functions for interacting with the caller.
send
function send(anydata res) returns Error?
Sends the outbound response to the caller.
grpc:Error? err = caller->send(message);
Parameters
- res anydata -
- The outbound response message
Return Type
- Error? -
- A
grpc:Error
if an error occurs while sending the response or else()
- A
complete
function complete() returns Error?
Informs the caller, when the server has sent all the messages.
grpc:Error? result = caller->complete();
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
sendError
Sends a server error to the caller.
grpc:Error? result = caller->sendError(error grpc:AbortedError("Operation aborted"));
Parameters
- err Error - Error instance.
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
getId
function getId() returns int
Returns the unique identification of the caller.
int result = caller.getId();
Return Type
- int - caller ID
isCancelled
function isCancelled() returns boolean
Checks whether the connection is closed by the caller.
boolean result = caller.isCancelled();
Return Type
- boolean - True if the caller has already closed the connection or else false
grpc: Client
The base client used in the generated client code to provide the capability for initiating the contact and executing remote calls with a remote gRPC service.
Constructor
Gets invoked to initialize the endpoint. During the initialization, the configurations provided through the config
record are used for the endpoint initialization.
HelloWorldClient helloWorldClient = check new("http://localhost:9091");
init (string url, *ClientConfiguration config)
- url string - The server URL
- config *ClientConfiguration -
- The client endpoint configurations
executeSimpleRPC
function executeSimpleRPC(string methodID, anydata payload, map<string|string[]> headers) returns ([anydata, map<string|string[]>]|Error)
Calls when executing a unary gRPC service.
[anydata, map<string|string[]>]|grpc:Error result = grpcClient->executeSimpleRPC("HelloWorld/hello", req, headers);
Parameters
- methodID string - Remote service method ID
- payload anydata - Request message. The message type varies with the remote service method parameter
Return Type
executeServerStreaming
function executeServerStreaming(string methodID, anydata payload, map<string|string[]> headers) returns [stream<anydata, Error?>, map<string|string[]>]|Error
Calls when executing a server streaming call with a gRPC service.
[stream<anydata, grpc:Error?>, map<string|string[]>]|grpc:Error result = grpcClient->executeServerStreaming("HelloWorld/hello", req, headers);
Parameters
- methodID string - Remote service method ID
- payload anydata - Request message. The message type varies with the remote service method parameter
Return Type
executeClientStreaming
function executeClientStreaming(string methodID, map<string|string[]> headers) returns StreamingClient|Error
Calls when executing a client streaming call with a gRPC service.
grpc:StreamingClient|grpc:Error result = grpcClient->executeClientStreaming("HelloWorld/hello", headers);
Parameters
- methodID string - Remote service method ID
Return Type
- StreamingClient|Error - A
grpc:StreamingClient
object or agrpc:Error
when an error occurs
executeBidirectionalStreaming
function executeBidirectionalStreaming(string methodID, map<string|string[]> headers) returns StreamingClient|Error
Calls when executing a bi-directional streaming call with a gRPC service.
grpc:StreamingClient|grpc:Error result = grpcClient->executeBidirectionalStreaming("HelloWorld/hello", headers);
Parameters
- methodID string - Remote service method ID
Return Type
- StreamingClient|Error - A
grpc:StreamingClient
object or agrpc:Error
when an error occurs
initStub
function initStub(AbstractClientEndpoint clientEndpoint, string descriptorKey, map<any> descriptorMap) returns Error?
Calls when initializing the client endpoint with the service descriptor data extracted from the proto file.
grpc:Error? result = grpcClient.initStub(self, ROOT_DESCRIPTOR, getDescriptorMap());
Parameters
- clientEndpoint AbstractClientEndpoint - Client endpoint
- descriptorKey string - Key of the proto descriptor
- descriptorMap map<any> (default {}) - Proto descriptor map with all the dependent descriptors
Return Type
- Error? - A
grpc:Error
if an error occurs while initializing the stub or else()
grpc: ClientOAuth2Handler
Defines the OAuth2 handler for client authentication.
Constructor
Initializes the OAuth2 handler for client authentication.
init (OAuth2GrantConfig config)
- config OAuth2GrantConfig - OAuth2 refresh token grant configurations
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The updated
map<string|string[]>
headers map instance or else agrpc:ClientAuthError
in case of an error
grpc: ListenerLdapUserStoreBasicAuthHandler
Defines the LDAP store Basic Auth handler for listener authentication.
Constructor
Initializes the LDAP user store Basic Auth handler for listener authentication.
init (LdapUserStoreConfig config)
- config LdapUserStoreConfig - LDAP user store configurations
authenticate
function authenticate(map<string|string[]> headers) returns UserDetails|UnauthenticatedError
Authenticates with the relevant authentication requirements.
Return Type
- UserDetails|UnauthenticatedError - The
auth:UserDetails
instance or else angrpc:UnauthenticatedError
error
authorize
function authorize(UserDetails userDetails, string|string[] expectedScopes) returns PermissionDeniedError?
Authorizes with the relevant authorization requirements.
Parameters
- userDetails UserDetails - The
auth:UserDetails
instance which is received from authentication results
Return Type
- PermissionDeniedError? -
()
, if it is successful or else agrpc:PermissionDeniedError
error
grpc: ListenerOAuth2Handler
Defines the OAuth2 handler for listener authentication.
Constructor
Initializes the OAuth2 handler for the listener authentication.
init (OAuth2IntrospectionConfig config)
- config OAuth2IntrospectionConfig - OAuth2 introspection server configurations
authorize
function authorize(map<string|string[]> headers, string|string[]? expectedScopes, map<string>? optionalParams) returns IntrospectionResponse|UnauthenticatedError|PermissionDeniedError
Authorizes with the relevant authentication & authorization requirements.
Parameters
Return Type
- IntrospectionResponse|UnauthenticatedError|PermissionDeniedError - The
oauth2:IntrospectionResponse
instance or elsegrpc:UnauthenticatedError
orgrpc:PermissionDeniedError
type error
grpc: ServerReflectionServerReflectionResponseCaller
This is used for internal purposes to support reflection.
sendServerReflectionResponse
function sendServerReflectionResponse(ServerReflectionResponse response) returns Error?
Parameters
- response ServerReflectionResponse -
sendError
Parameters
- response Error -
complete
function complete() returns Error?
getId
function getId() returns int
isCancelled
function isCancelled() returns boolean
grpc: StreamingClient
The base client used in the generated client code to provide the gRPC streaming client actions for interacting with the gRPC server.
send
function send(anydata res) returns Error?
Sends the request message to the server.
grpc:Error? err = sClient->send(message);
Parameters
- res anydata - The inbound request message
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
complete
function complete() returns Error?
Informs the server when the caller has sent all the messages.
grpc:Error? result = sClient->complete();
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
sendError
Sends an error message to the server.
grpc:Error? result = sClient->sendError(error grpc:AbortedError("Operation aborted"));
Parameters
- err Error - Error instance
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
receive
Receives server responses in client streaming and bidirectional streaming.
[anydata, map<string|string[]>]|grpc:Error? result = streamingClient->receive();
Service types
grpc: Service
The gRPC service type.
Constants
grpc: AUTH_HEADER
Represents the Authorization header name.
grpc: AUTH_SCHEME_BASIC
The prefix used to denote the Basic authentication scheme.
grpc: AUTH_SCHEME_BEARER
The prefix used to denote the Bearer authentication scheme.
grpc: COMPRESSION_ALWAYS
Always set accept-encoding/content-encoding in outbound request/response.
grpc: COMPRESSION_AUTO
When service behaves as a HTTP gateway inbound request/response accept-encoding option is set as the outbound request/response accept-encoding/content-encoding option.
grpc: COMPRESSION_NEVER
Never set accept-encoding/content-encoding header in outbound request/response.
grpc: DEALINE_HEADER
Represents the deadline header name.
grpc: PERMISSION_DENIED_ERROR_MSG
The permission denied error message.
grpc: UNAUTHENTICATED_ERROR_MSG
The permission denied error message.
Enums
grpc: CertValidationType
Represents certification validation type options.
Members
grpc: CompressionType
Compression types that are supported. GZIP - Gzip compression
Members
grpc: Protocol
Represents protocol options.
Members
grpc: VerifyClient
Represents client verify options.
Members
Listeners
grpc: Listener
The server listener of which one or more services can be registered so that the Ballerina program can offer a service through this listener.
Constructor
Gets called when the endpoint is being initialized during the module init time.
listener grpc:Listener listenerEp = new (9092);
init (int port, *ListenerConfiguration config)
- port int - The listener port
- config *ListenerConfiguration - The listener endpoint configuration
attach
Gets called every time a service attaches itself to this endpoint - also happens at module init time.
error? result = listenerEp.attach(helloService);
Parameters
- grpcService Service - The type of the service to be registered
Return Type
- error? - An
error
if an error occurs while attaching the service or else()
'start
function 'start() returns error?
Starts the registered service.
error? result = listenerEp.'start();
Return Type
- error? - An
error
if an error occurs while starting the server or else()
gracefulStop
function gracefulStop() returns error?
Stops the service listener gracefully. Already-accepted requests will be served before the connection closure.
error? result = listenerEp.gracefulStop();
Return Type
- error? - An
error
if an error occurred during the listener stopping process or else()
immediateStop
function immediateStop() returns error?
Stops the registered service.
error? result = listenerEp.immediateStop();
Return Type
- error? - An
error
if an error occurs while stopping the server or else()
detach
Detaches an HTTP or WebSocket service from the listener. Note that detaching a WebSocket service would not affect the functionality of the existing connections.
error? result = listenerEp.detach(helloService);
Parameters
- grpcService Service - The service to be detached
Return Type
- error? - An
error
if an error occurred during the detaching of the service or else()
Annotations
grpc: Descriptor
Service descriptor annotation.
grpc: ServiceConfig
The annotation which is used to configure a gRPC service.
grpc: ServiceDescriptor
Service descriptor annotation.
Configurables
grpc: maxActiveConnections
grpc: maxIdleConnections
grpc: waitTime
grpc: maxActiveStreamsPerConnection
grpc: traceLogConsole
grpc: traceLogAdvancedConfig
grpc: accessLogConfig
Records
grpc: AccessLogConfiguration
Represents gRPC access log configuration.
Fields
- console boolean(default false) - Boolean value to enable or disable console access logs
- path? string - Optional file path to store access logs
grpc: BearerTokenConfig
Represents token for Bearer token authentication.
Fields
- token string - Bearer token for authentication
grpc: CertKey
Represents combination of certificate, private key and private key password if encrypted.
Fields
- certFile string - A file containing the certificate
- keyFile string - A file containing the private key
- keyPassword? string - Password of the private key if it is encrypted
grpc: ClientConfiguration
Configurations for managing the gRPC client endpoint.
Fields
- timeout decimal(default 60) - The maximum time to wait(in seconds) for a response before closing the connection
- poolConfig PoolConfiguration?(default ()) - Connection pool configuration
- secureSocket ClientSecureSocket?(default ()) - SSL/TLS related options
- compression Compression(default COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- retryConfiguration RetryConfiguration?(default ()) - Configures the retry functionality
- auth ClientAuthConfig?(default ()) - Configurations related to client authentication
- maxInboundMessageSize int(default 4194304) - The maximum message size to be permitted for inbound messages. Default value is 4 MB
grpc: ClientSecureSocket
Configurations for facilitating secure communication with a remote gRPC endpoint.
Fields
- enable boolean(default true) - Enable SSL validation
- cert? TrustStore|string - Configurations associated with the
crypto:TrustStore
or a single certificate file that the client trusts
- key? KeyStore|CertKey - Configurations associated with
crypto:KeyStore
or combination of certificate and private key of the client
- certValidation? record {| 'type CertValidationType, cacheSize int, cacheValidityPeriod int |} - Certificate validation against OCSP_CRL, OCSP_STAPLING related options
- ciphers? string[] - List of ciphers to be used eg: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
- verifyHostName boolean(default true) - Enable/disable host name verification
- shareSession boolean(default true) - Enable/disable new SSL session creation
- handshakeTimeout? decimal - SSL handshake time out(in seconds)
- sessionTimeout? decimal - SSL session time out(in seconds)
grpc: CredentialsConfig
Represents credentials for Basic Auth authentication.
grpc: DescriptorData
Service descriptor data generated at the compile time.
Fields
- value string - Descriptor, which should be set at the compile time
grpc: ErrorResponse
This is used for internal purposes to support reflection. This represents the error code and error message sent by the server when an error occurs.
Fields
- error_code int(default 0) - error codes adhering to
grpc::StatusCode
- error_message string(default "") - related error message sent by the server
grpc: ExtensionNumberResponse
This is used for internal purposes to support reflection. A list of extension numbers sent by the server answering all_extension_numbers_of_type request.
Fields
- base_type_name string(default "") - full name of the base type, including the package name. The format is
<package>.<type>
- extension_number int[](default []) - list of extension numbers
grpc: ExtensionRequest
This is used for internal purposes to support reflection.
The type name and extension number sent by the client when requesting file_containing_extension
.
Fields
- containing_type string(default "") - fully-qualified type name. The format should be
<package>.<type>
- extension_number int(default 0) - specific extension number
grpc: FileDescriptorResponse
This is used for internal purposes to support reflection.
Serialized FileDescriptorProto
messages sent by the server answering a
file_by_filename
, file_containing_symbol
, or file_containing_extension
request.
Fields
- file_descriptor_proto byte[](default []) - serialized
FileDescriptorProto
messages
grpc: FileUserStoreConfig
Represents file user store configurations for Basic Auth authentication.
grpc: FileUserStoreConfigWithScopes
Represents the auth annotation for file user store configurations with scopes.
Fields
- fileUserStoreConfig FileUserStoreConfig - File user store configurations for Basic Auth authentication
grpc: GrpcServiceConfig
Contains the configurations for a gRPC service.
Fields
- auth? ListenerAuthConfig[] - Listener authenticaton configurations
grpc: JwtIssuerConfig
Represents JWT issuer configurations for JWT authentication.
grpc: JwtValidatorConfig
Represents JWT validator configurations for JWT authentication.
Fields
- scopeKey string(default "scope") - The key used to fetch the scopes
grpc: JwtValidatorConfigWithScopes
Represents the auth annotation for JWT validator configurations with scopes.
Fields
- jwtValidatorConfig JwtValidatorConfig - JWT validator configurations for JWT authentication
grpc: LdapUserStoreConfig
Represents LDAP user store configurations for Basic Auth authentication.
grpc: LdapUserStoreConfigWithScopes
Represents the auth annotation for LDAP user store configurations with scopes.
Fields
- ldapUserStoreConfig LdapUserStoreConfig - LDAP user store configurations for Basic Auth authentication
grpc: ListenerConfiguration
Configurations for managing the gRPC server endpoint.
Fields
- host string(default "0.0.0.0") - The server hostname
- secureSocket ListenerSecureSocket?(default ()) - The SSL configurations for the server endpoint
- timeout decimal(default DEFAULT_LISTENER_TIMEOUT) - Period of time in seconds that a connection waits for a read/write operation. Use value 0 to disable the timeout
- maxInboundMessageSize int(default 4194304) - The maximum message size to be permitted for inbound messages. Default value is 4 MB
- maxHeaderSize int(default 8192) - The maximum size of the headers to be permitted for inbound messages. Default value is 8 KB
- reflectionEnabled boolean(default false) - Support reflection
grpc: ListenerSecureSocket
Configurations for facilitating secure communication for the gRPC server endpoint.
Fields
- key KeyStore|CertKey - Configurations associated with a
crypto:KeyStore
or combination of a certificate and private key of the server
- mutualSsl? record {| verifyClient VerifyClient, cert TrustStore|string |} - Configurations associated with mutual SSL operations
- certValidation? record {| 'type CertValidationType, cacheSize int, cacheValidityPeriod int |} - Certificate validation against OCSP_CRL, OCSP_STAPLING related options
- ciphers string[](default [ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" ]) - List of ciphers to be used eg: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
- shareSession boolean(default true) - Enable/Disable new SSL session creation
- handshakeTimeout? decimal - SSL handshake time out(in seconds)
- sessionTimeout? decimal - SSL session time out(in seconds)
grpc: ListServiceResponse
This is used for internal purposes to support reflection.
A list of ServiceResponse
sent by the server answering list_services request.
Fields
- 'service ServiceResponse[](default []) - list of
ServiceResponse
s
grpc: OAuth2ClientCredentialsGrantConfig
Represents OAuth2 client credentials grant configurations for OAuth2 authentication.
grpc: OAuth2IntrospectionConfig
Represents OAuth2 introspection server configurations for OAuth2 authentication.
Fields
- scopeKey string(default "scope") - The key used to fetch the scopes
grpc: OAuth2IntrospectionConfigWithScopes
Represents the auth annotation for OAuth2 introspection server configurations with scopes.
Fields
- oauth2IntrospectionConfig OAuth2IntrospectionConfig - OAuth2 introspection server configurations for OAuth2 authentication
grpc: OAuth2JwtBearerGrantConfig
Represents OAuth2 JWT bearer grant configurations for OAuth2 authentication.
grpc: OAuth2PasswordGrantConfig
Represents OAuth2 password grant configurations for OAuth2 authentication.
grpc: OAuth2RefreshTokenGrantConfig
Represents OAuth2 refresh token grant configurations for OAuth2 authentication.
grpc: PoolConfiguration
Configurations for managing the gRPC client connection pool.
Fields
- maxActiveConnections int(default maxActiveConnections) - Max active connections per route(host:port). The default value is -1, which indicates unlimited
- maxIdleConnections int(default maxIdleConnections) - Maximum number of idle connections allowed per pool
- waitTime decimal(default waitTime) - Maximum amount of time the client should wait for an idle connection before it sends an error when the pool is exhausted
- maxActiveStreamsPerConnection int(default maxActiveStreamsPerConnection) - Maximum active streams per connection. This only applies to HTTP/2
grpc: RetryConfiguration
Configurations for facilitating the retry capability of the gRPC client.
Fields
- retryCount int - Maximum number of retry attempts in a failure scenario
- interval decimal - Initial interval(in seconds) between the retry attempts
- maxInterval decimal - Maximum interval(in seconds) between two retry attempts
- backoffFactor decimal - Retry interval will be multiplied by this factor, in between retry attempts
- errorTypes ErrorType[](default defaultErrorTypes) - Error types which should be considered as failure scenarios to retry
grpc: ServerReflectionRequest
This is used for internal purposes to support reflection.
The message sent by the client when calling ServerReflectionInfo
method.
Fields
- host string(default "") - fully-qualified type name
- file_by_filename? string - used to find a proto file by the file name
- file_containing_symbol? string - used to find the proto file that declares the given fully-qualified symbol name
- file_containing_extension? ExtensionRequest - find the proto file which defines an extension extending the given message type with the given field number.
- all_extension_numbers_of_type? string - used to find the tag numbers used by all known extensions of the given message type
- list_services? string - used to list the full names of registered services
grpc: ServerReflectionResponse
This is used for internal purposes to support reflection.
The message sent by the server to answer ServerReflectionInfo
method.
Fields
- valid_host string(default "") - valid host as a string
- original_request ServerReflectionRequest(default {}) - original request send by the client
- file_descriptor_response? FileDescriptorResponse - used to answer
file_by_filename
,file_containing_symbol
,file_containing_extension
requests with transitive dependencies
- all_extension_numbers_response? ExtensionNumberResponse - used to answer
all_extension_numbers_of_type
requst
- list_services_response? ListServiceResponse - used to answer list_services request
- error_response? ErrorResponse - used when an error occurs
grpc: ServiceDescriptorData
Service descriptor data generated at the compile time.
Fields
- descriptor string(default "") - Service descriptor, which should be set at the compile time
- descMap map<anydata>(default {}) - Service-dependent descriptor map, which should be set at the compile time
grpc: ServiceResponse
This is used for internal purposes to support reflection.
The information of a single service used by ListServiceResponse
to answer list_services
request.
Fields
- name string(default "") - full name of a registered service, including its package name. The format is
<package>.<service>
grpc: TraceLogAdvancedConfiguration
Represents gRPC trace log configuration.
Fields
- console boolean(default false) - Boolean value to enable or disable console trace logs
- path? string - Optional file path to store trace logs
- host? string - Optional socket hostname to publish the trace logs
- port? int - Optional socket port to publish the trace logs
Errors
grpc: AbortedError
Represents error occur when operation is aborted.
grpc: AllRetryAttemptsFailed
Represents error scenario where the maximum retry attempts are done and still received an error.
grpc: AlreadyExistsError
Represents error occur when attempt to create an entity which already exists.
grpc: CancelledError
Represents the operation canceled(typically by the caller) error.
grpc: ClientAuthError
Represents an error when client authentication error occured.
grpc: DataLossError
Represents unrecoverable data loss or corruption erros.
grpc: DataMismatchError
Represents an error when expected data type is not available.
grpc: DeadlineExceededError
Represents operation expired before completion error.
grpc: Error
Represents gRPC related errors.
grpc: FailedPreconditionError
Represents error occur when operation is rejected because the system is not in a state required for the operation's execution.
grpc: InternalError
Represents internal error.
grpc: InvalidArgumentError
Represents client specified an invalid argument error.
grpc: NotFoundError
Represents requested entity (e.g., file or directory) not found error.
grpc: OutOfRangeError
Represents error occur when specified value is out of range.
grpc: PermissionDeniedError
Represents error occur when the caller does not have permission to execute the specified operation.
grpc: ResiliencyError
Represents all the resiliency-related errors.
grpc: ResourceExhaustedError
Represents error occur when the resource is exhausted.
grpc: StreamClosedError
Represents an error when calling next when the stream has closed.
grpc: UnauthenticatedError
Represents error occur when the request does not have valid authentication credentials for the operation.
grpc: UnavailableError
Represents error occur when the service is currently unavailable.
grpc: UnimplementedError
Represents error occur when operation is not implemented or not supported/enabled in this service.
grpc: UnKnownError
Represents unknown error(e.g., Status value received is unknown).
Object types
grpc: AbstractClientEndpoint
Represents the abstract gRPC client endpoint. This abstract object is used in the generated client.
Union types
grpc: OAuth2GrantConfig
OAuth2GrantConfig
Represents OAuth2 grant configurations for OAuth2 authentication.
grpc: ClientAuthConfig
ClientAuthConfig
Defines the authentication configurations for the HTTP client.
grpc: ListenerAuthConfig
ListenerAuthConfig
Defines the authentication configurations for the gRPC listener.
grpc: Compression
Compression
Represents compression options.
AUTO
: When the service behaves as a HTTP gateway, the inbound request/response accept-encoding option is set as the
outbound request/response accept-encoding/content-encoding option
ALWAYS
: Always set accept-encoding/content-encoding in outbound request/response
NEVER
: Never set accept-encoding/content-encoding header in outbound request/response
Type descriptor types
grpc: ErrorType
ErrorType
Represents gRPC related error types.
Import
import ballerina/grpc;
Metadata
Released date: 11 days ago
Version: 1.13.1
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.11.0
GraalVM compatible: Yes
Pull count
Total: 48798
Current verison: 24
Weekly downloads
Keywords
network
grpc
protobuf
server-streaming
client-streaming
bidirectional-streaming
Contributors