Members
(constant) DEFAULT_INITIAL_RPC_TIMEOUT
Default initial RPC timeout for Publish calls (from publisher_client_config.json).
(constant) DEFAULT_TOTAL_TIMEOUT
Default total timeout for Publish calls (from publisher_client_config.json).
(constant) FINAL_NACK_TIMEOUT
Specifies how long before the final close timeout, in WaitForProcessing mode, that we should give up and start shutting down cleanly.
(constant) HEDGE_TOKEN_SCALE
Scale factor to represent decimal token values (e.g. 0.1 refill ratio) as integers inside the token bucket. A scale of 1000 allows representing decimal ratios down to 0.001 (1.0 logical token = 1000).
(constant) MAX_HEDGE_ATTEMPT_TIMEOUT
Maximum timeout for an individual hedged publish attempt (10s).
(constant) MAX_HEDGE_DELAY
Maximum allowed hedging delay (10s).
(constant) MAX_MAX_TOKENS
Maximum allowed maxTokens value.
(constant) MAX_REFILL_RATIO
Maximum allowed refill ratio.
(constant) MIN_HEDGE_DELAY
Minimum allowed hedging delay (100ms).
(constant) MIN_MAX_TOKENS
Minimum allowed maxTokens value.
(constant) MIN_REFILL_RATIO
Minimum allowed refill ratio.
OpenTelemetryLevel[undefined]
None: OTel support is not enabled because we found no trace provider, or the user has not enabled it.
OpenTelemetryLevel[undefined]
Modern: We will only inject/extract the modern propagation attribute.
SubscriberCloseBehaviors
Enum values for behaviors of the Subscriber.close() method.
(constant) ZERO_DURATION
Zero duration constant for non-negative clamping and comparisons.
Methods
(async) awaitWithTimeout(promise, timeout)
Awaits on Promise with a timeout. Resolves on the passed promise resolving or rejecting, or on timeout.
Parameters:
| Name | Type | Description |
|---|---|---|
promise |
An existing Promise returning type T. |
|
timeout |
A timeout value as a Duration; if the timeout is exceeded while
waiting for the promise, the Promise this function returns will resolve, but
with |
Returns:
| Type | Description |
|---|---|
|
A TimeoutReturn with the returned value, if applicable, an exception if the promise rejected, or the timedOut set to true if it timed out. |
Type Definitions
BatchOptions
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
callOptions |
object |
<optional> |
Request configuration option, outlined here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html. |
|
maxMessages |
number |
<optional> |
3000 |
Maximum number of messages allowed in each batch sent. |
maxMilliseconds |
number |
<optional> |
100 |
Maximum duration to wait before sending a batch. Batches can be sent earlier if the maxMessages option is met before the configured duration has passed. |
BatchPublishOptions
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
maxBytes |
number |
<optional> |
1 * 1024 * 1024 |
The maximum number of bytes to buffer before sending a payload. |
maxMessages |
number |
<optional> |
100 |
The maximum number of messages to buffer before sending a payload. |
maxMilliseconds |
number |
<optional> |
10 |
The maximum duration to wait before sending a payload. |
ClientConfig
Properties:
| Name | Type | Attributes | Default | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string |
<optional> |
The project ID from the Google Developer's
Console, e.g. 'grape-spaceship-123'. We will also check the environment
variable |
|||||||||||||
keyFilename |
string |
<optional> |
@deprecated The |
|||||||||||||
apiEndpoint |
string |
<optional> |
The |
|||||||||||||
email |
string |
<optional> |
Account email address. Required when using a .pem or .p12 keyFilename. |
|||||||||||||
credentials |
object |
<optional> |
@deprecated The Properties
|
|||||||||||||
autoRetry |
boolean |
<optional> |
true |
Automatically retry requests if the response is related to rate limits or certain intermittent server errors. We will exponentially backoff subsequent requests by default. |
||||||||||||
promise |
Constructor |
<optional> |
Custom promise module to use instead of native Promises. |
ExpirationPolicy
A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. The minimum allowed value for expirationPolicy.ttl is 1 day.
Properties:
| Name | Type | Description |
|---|---|---|
ttl |
google.protobuf.Duration |
Specifies the "time-to-live"
duration for an associated resource. The resource expires if it is not
active for a period of |
FlowControlOptions
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
allowExcessMessages |
boolean |
<optional> |
true |
PubSub delivers messages in batches with no way to configure the batch size. Sometimes this can be overwhelming if you only want to process a few messages at a time. Setting this option to false will make the client manage any excess messages until you're ready for them. This will prevent them from being redelivered and make the maxMessages option behave more predictably. |
maxBytes |
number |
<optional> |
104857600 |
The desired amount of memory to allow message data to consume. (Default: 100MB) It's possible that this value will be exceeded, since messages are received in batches. |
maxMessages |
number |
<optional> |
1000 |
The desired number of messages to allow in memory before pausing the message stream. Unless allowExcessMessages is set to false, it is very likely that this value will be exceeded since any given message batch could contain a greater number of messages than the desired amount of messages. |
PublishOptions
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
batching |
BatchPublishOptions |
<optional> |
The maximum number of bytes to buffer before sending a payload. |
publisherFlowControl |
FlowControlOptions |
<optional> |
Publisher-side flow control settings. If this is undefined, Ignore will be the assumed action. |
gaxOpts |
object |
<optional> |
Request configuration options, outlined here. |
messageOrdering |
boolean |
<optional> |
If true, messages published with the same order key in Message will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. |
hedging |
HedgingOptions |
<optional> |
Settings for configuring publish hedging. |