Basic settings and options
Retry
If the response to a gRPC call corresponds to a configured error, the call is retried. The retry will be executed according to the configured Retry settings. The default retry responses and settings for each API are as follows.
Retry error status code
For more information, please refer to GRPC Github.
Item | Description |
---|---|
CANCELLED | If the call is canceled (usually canceled by the calling party) |
UNKNOWN | This error can be returned for unknown errors, for example, if a status value received from another address is not defined for that address - Also for APIs that do not provide information about response errors |
DEADLINE_EXCEEDED | The deadline expired before the call completed |
NOT_FOUND | Some requested entity (e.g. a file or path) could not be found |
RESOURCE_EXHAUSTED | Some resource is exhausted, or the user quota is insufficient, or the file system as a whole is out of space |
ABORTED | Usually when a sequencer check fails, or the operation is aborted due to a concurrency issue, such as in the middle of a transaction |
INTERNAL | Internal error |
UNAVAILABLE | The service is currently unavailable |
Retry settings
Item | Description |
---|---|
Jittered | Whether to randomly set the delay time - Most jitters are set to true |
InitiAlertryDelay | Delays to set before first retry - Use a value adjusted based on RetryDelayMultiplier |
RetryDelayMultiplier | Next call retry delay = previous call retry delay * RetryDelayMultiplier |
MaxRetryDelay | Sets a limit on retry delays - RetryMultiplier cannot set retry delays exceeding this value |
InitialRpcTimeout | Set a timeout for the first RPC - Use a value adjusted based on RpcTimeoutMultiplier |
RpcTimeoutMultiplier | Next call timeout = previous call timeout * RpcTimeoutMultiplier |
MaxRpcTimeout | Sets the RPC timeout - RpcTimeoutMultiplier cannot set the RPC timeout exceeding this value |
TotalTimeout | Ultimately controls how long we should keep trying remote calls before giving up on the logic entirely - The higher this value, the more retries we will execute |
Publisher retry settings
API | Retry code | Description | Retry setting |
---|---|---|---|
create topic | 14 | UNAVAILABLE | • Initial : 100ms • Multiplier : 1.3 • Max : 60s |
get topic | 2 | UNKNOWN | |
10 | ABORTED | ||
14 | UNAVAILABLE | ||
list topics | 2 | UNKNOWN | |
10 | ABORTED | ||
14 | UNAVAILABLE | ||
list topic subscriptions | 2 | UNKNOWN | |
10 | ABORTED | ||
14 | UNAVAILABLE | ||
update topic | 14 | UNAVAILABLE | |
delete topic | 14 | UNAVAILABLE | |
publish | 1 | CANCELLED | |
2 | UNKNOWN | ||
4 | DEADLINE_EXCEEDED | ||
8 | RESOURCE_EXHAUSTED | ||
10 | ABORTED | ||
13 | INTERNAL | ||
14 | UNAVAILABLE |
Subscriber retry settings
API | Retry code | Description | Retry setting |
---|---|---|---|
create subscription | 14 | UNAVAILABLE | • Initial: 100ms • Multiplier: 1.3 • Max: 60s |
get subscription | 14 | UNAVAILABLE | |
list subscriptions | 14 | UNAVAILABLE | |
seek | 14 | UNAVAILABLE | |
update subscription | 14 | UNAVAILABLE | |
delete subscription | 14 | UNAVAILABLE | |
modify ack deadline | 14 | UNAVAILABLE | |
acknowledge | 14 | UNAVAILABLE | |
pull | 14 | UNAVAILABLE | |
streaming pull | 4 | DEADLINE_EXCEEDED | |
8 | RESOURCE_EXHAUSTED | ||
13 | INTERNAL | ||
14 | UNAVAILABLE |
Batch processing
When making an API call, messages can be bundled and sent in batches.
Limit Exceeded Behavior
Action to take when the flow control limit is exceeded
SignalError
: Returns an error.Block
: Waits until the request can be made without exceeding the limit. Useful in batch processing where the latency of individual requests is not important.Ignore
: Does not use flow control.
API | Batching Settings | Element Count Threshold | Request Bytes Threshold | Delay Threshold | Limit Exceeded Behavior |
---|---|---|---|---|---|
publish | 100 | 1000 (=1KB) | 10ms | SignalError |
Logging
You can leave logs for requests and responses (success/failure) in Publish and StreamingPull as statistics.
- If you set a time interval, the number of successes/failures of publish and pull will be output for each interval.
- If you want to check the output, you must set it to info level or higher.
The following values can be set for Logger by default.
Item | Description |
---|---|
Level | Log level - Default: Panic |
Output | Log output - Default: os.Stdout |
StatLogInterval | Time interval to leave logs |
Logging example
conf := &ClientConfig{
LogOptions: &LogOptions{
Level: "info",
Output: os.Stdout,
StatLogInterval: 1 * time.Second
}
}
client, err := NewClientWithConfig(ctx, domainID, projectID, conf, opts...)