Skip to main content

Default settings and options

Default settings

Configure publish and receive (pull) settings to handle messages efficiently.

Publish Settings
ItemDescription
DelayThresholdSends a publish request to the server at the specified interval.
- Default: 100ms.
CountThresholdCollects and sends messages in batches of the specified size.
- Default: 100.
NumGoroutinesLimits the number of concurrently running Goroutines.
- Default: 2.
- Max: 10.
TimeoutSets the timeout for server requests.
- Default: 60s.
FlowControlSettingsControls publishing rate through flow control.
Receive Settings
ItemDescription
NumGoroutinesLimits the number of concurrently running Goroutines.
- Default: 2.
- Max: 10.
FlowControlSettingsControls publishing rate through flow control.
FlowControl Settings
ItemDescription
MaxOutstandingMessagesSpecifies the maximum number of messages that can be processed in the internal buffer.
- Default: 1000.
MaxOutstandingBytesSpecifies the maximum size of messages that can be processed in the internal buffer.
- Default: 1G.
LimitExceededBehaviorDefines behavior when limits are exceeded.
SignalError: Returns an error.
Block (Default): Waits until requests can be made without exceeding the limit (*useful for batch processing where individual request latency is not critical).
Ignore: Disables flow control.

Retry

When a gRPC call encounters an error corresponding to a specified status, it will retry the call based on the configured retry settings. Each API includes default retry responses and settings as described below.

Retry error status codes

For more details, refer to GRPC Github.

ItemDescription
CANCELLEDThe call was canceled, usually by the client.
UNKNOWNUnknown error, for example, a response from another address that is not defined for this address.
- Also applies when the API does not provide detailed error information.
DEADLINE_EXCEEDEDThe deadline expired before the operation completed.
NOT_FOUNDSome requested entity (e.g., file or path) was not found.
RESOURCE_EXHAUSTEDResources are exhausted (e.g., insufficient per-user quota or insufficient disk space).
ABORTEDOperation aborted, often due to concurrency issues such as sequencer check failure or mid-transaction conflicts.
INTERNALInternal server error.
UNAVAILABLEThe service is currently unavailable.
Retry settings
ItemDescription
InitialThe delay before the first retry.
- Adjusted based on the Multiplier value.
MultiplierNext retry delay = Previous retry delay * Multiplier.
MaxSets a limit on retry delay.
⚠️ Multiplier cannot cause retry delay to exceed this value.
Publisher Retry Default Setting
APIRetry codeDescriptionRetry setting
create topic14     UNAVAILABLE• Initial : 100ms
• Multiplier : 1.3
• Max : 60s
get topic14UNAVAILABLE
list topics14UNAVAILABLE
list topic subscriptions14UNAVAILABLE
update topic14UNAVAILABLE
delete topic14UNAVAILABLE
publish1CANCELLED
4DEADLINE_EXCEEDED
8RESOURCE_EXHAUSTED
13INTERNAL
14UNAVAILABLE
Subscriber Retry Default Settings
APIRetry codeDescriptionRetry setting
create subscription14     UNAVAILABLE• Initial : 100ms
• Multiplier : 1.3
• Max : 60s
get subscription14UNAVAILABLE
list subscriptions14UNAVAILABLE
seek14UNAVAILABLE
update subscription14UNAVAILABLE
delete subscription14UNAVAILABLE
modify ack deadline14UNAVAILABLE
acknowledge14UNAVAILABLE
pull14UNAVAILABLE
streaming pull4DEADLINE_EXCEEDED
8RESOURCE_EXHAUSTED
13INTERNAL
14UNAVAILABLE
example.
cfg := &pubsub.ClientConfig{
PublisherCallOptions: &api.PublisherCallOptions{
Publish: []option.CallOption{
option.WithRetryOptions(
option.WithCodes(codes.ResourceExhausted),
option.WithBackoff(option.Backoff{
Initial: 100 * time.Millisecond,
Max: 30000 * time.Millisecond,
Multiplier: 1.20,
})),
},
},
SubscriberCallOptions: &api.SubscriberCallOptions{
StreamingPull: []option.CallOption{
option.WithRetryOptions(
option.WithCodes(codes.ResourceExhausted),
option.WithBackoff(option.Backoff{
Initial: 100 * time.Millisecond,
Max: 60000 * time.Millisecond,
Multiplier: 1.30,
})),
},
},
}
client, err := NewClientWithConfig(ctx, domainID, projectID, conf, opts...)

Logging

Logs for requests and responses (success/failure) in Publish and StreamingPull can be recorded for statistical purposes.

  • If a time interval is configured, the success/failure counts for publish and pull operations are logged at each interval.
  • To view the logs, the log level must be set to info or higher.

The following default values can be configured for the logger:

ItemDescription
LevelLog level
- Default: Panic.
OutputLog output
- Default: os.Stdout.
StatLogIntervalTime interval for recording logs.
Logging example
conf := &ClientConfig{
LogOptions: &LogOptions{
Level: "info",
Output: os.Stdout,
StatLogInterval: 1 * time.Second
}
}
client, err := NewClientWithConfig(ctx, domainID, projectID, conf, opts...)