Global

Type Definitions

BatchOptions :object

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>
1024^2 * 5

The maximum number of bytes to buffer before sending a payload.

maxMessages number <optional>
1000

The maximum number of messages to buffer before sending a payload.

maxMilliseconds number <optional>
100

The maximum duration to wait before sending a payload.

ClientConfig :object

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 GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option above is not necessary. NOTE: .pem and .p12 require you to specify the email option as well.

apiEndpoint string <optional>

The apiEndpoint from options will set the host. If not set, the PUBSUB_EMULATOR_HOST environment variable from the gcloud SDK is honored, otherwise the actual API endpoint will be used.

email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
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.

maxRetries number <optional>
3

Maximum number of automatic retries attempted before returning the error.

promise Constructor <optional>

Custom promise module to use instead of native Promises.

CreateSnapshotCallback(errnullable, snapshot, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

snapshot Snapshot

The new Snapshot.

apiResponse object

The full API response.

CreateSnapshotResponse :array

Properties:
Name Type Description
0 Snapshot

The new Snapshot.

1 object

The full API response.

CreateSubscriptionCallback(errnullable, Subscription, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

Subscription Subscription
apiResponse object

The full API response.

CreateSubscriptionRequest :object

Options for creating a subscription.

See a Subscription resource.

Properties:
Name Type Attributes Default Description
deadLetterPolicy DeadLetterPolicy <optional>

A policy that specifies the conditions for dead lettering messages in this subscription.

flowControl object <optional>

Flow control configurations for receiving messages. Note that these options do not persist across subscription instances.

Properties
Name Type Attributes Default Description
maxBytes number <optional>

The maximum number of bytes in un-acked messages to allow before the subscription pauses incoming messages. Defaults to 20% of free memory.

maxMessages number <optional>
Infinity

The maximum number of un-acked messages to allow before the subscription pauses incoming messages.

gaxOpts object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.

messageRetentionDuration number | google.protobuf.Duration <optional>

Set this to override the default duration of 7 days. This value is expected in seconds. Acceptable values are in the range of 10 minutes and 7 days.

pushEndpoint string <optional>

A URL to a custom endpoint that messages should be pushed to.

oidcToken object <optional>

If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. This object should have the same structure as OidcToken

retainAckedMessages boolean <optional>
false

If set, acked messages are retained in the subscription's backlog for the length of time specified by options.messageRetentionDuration.

expirationPolicy ExpirationPolicy <optional>

A policy that specifies the conditions for this subscription's expiration.

CreateSubscriptionResponse :array

Properties:
Name Type Description
0 Subscription

The new Subscription.

1 object

The full API response.

CreateTopicCallback(errnullable, topic, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

topic Topic

The new Topic.

apiResponse object

The full API response.

CreateTopicResponse :array

Properties:
Name Type Description
0 Topic

The new Topic.

1 object

The full API response.

EmptyCallback() → {Promise.<void>}

Closes out this object, releasing any server connections. Note that once you close a PubSub object, it may not be used again. Any pending operations (e.g. queued publish messages) will fail. If you have topic or subscription objects that may have pending operations, you should call close() on those first if you want any pending messages to be delivered correctly. The PubSub class doesn't track those.

ExpirationPolicy :object

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 ttl. The definition of "activity" depends on the type of the associated resource. The minimum and maximum allowed values for ttl depend on the type of the associated resource, as well. If ttl is not set, the associated resource never expires.

FlowControlOptions :object

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.

maxExtension number <optional>
60

The maximum duration (in seconds) to extend the message deadline before redelivering.

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.

GetPolicyCallback(errnullable, acl)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

acl object

The policy.

GetPolicyResponse :array

Properties:
Name Type Description
0 object

The policy.

GetSnapshotsCallback(errnullable, snapshots, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

snapshots Array.<Snapshot>

Array of Snapshot instances.

apiResponse object

The full API response.

GetSnapshotsRequest :object

Query object for listing snapshots.

Properties:
Name Type Attributes Default Description
autoPaginate boolean <optional>
true

Have pagination handled automatically.

options.gaxOpts object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.

options.pageSize number <optional>

Maximum number of results to return.

options.pageToken string <optional>

Page token.

GetSnapshotsResponse :array

Properties:
Name Type Description
0 Array.<Snapshot>

Array of Snapshot instances.

1 object

The full API response.

GetSubscriptionCallback(errnullable, subscription, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

subscription Subscription

The Subscription.

apiResponse object

The full API response.

GetSubscriptionMetadataCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

GetSubscriptionMetadataResponse :array

Properties:
Name Type Description
0 object

The full API response.

GetSubscriptionResponse :array

Properties:
Name Type Description
0 Subscription

The Subscription.

1 object

The full API response.

GetSubscriptionsCallback(errnullable, subscriptions, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

subscriptions Array.<Subscription>

Array of Subscription instances.

apiResponse object

The full API response.

GetSubscriptionsRequest :object

Query object for listing subscriptions.

Parameters:
Name Type Description
options.topic string | Topic

The name of the topic to list subscriptions from.

Properties:
Name Type Attributes Default Description
autoPaginate boolean <optional>
true

Have pagination handled automatically.

options.gaxOpts object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.

options.pageSize number <optional>

Maximum number of results to return.

options.pageToken string <optional>

Page token.

GetSubscriptionsResponse :array

Properties:
Name Type Description
0 Array.<Subscription>

Array of Subscription instances.

1 object

The full API response.

GetTopicCallback(errnullable, topic, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

topic Topic

The Topic.

apiResponse object

The full API response.

GetTopicMetadataCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

GetTopicMetadataResponse :array

Properties:
Name Type Description
0 object

The full API response.

GetTopicResponse :array

Properties:
Name Type Description
0 Topic

The Topic.

1 object

The full API response.

GetTopicsCallback(errnullable, topics, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

topics Array.<Topic>

Array of Topic instances.

apiResponse object

The full API response.

GetTopicsRequest :object

Query object for listing topics.

Properties:
Name Type Attributes Default Description
autoPaginate boolean <optional>
true

Have pagination handled automatically.

options.gaxOpts object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.

options.pageSize number <optional>

Maximum number of results to return.

options.pageToken string <optional>

Page token.

GetTopicsResponse :array

Properties:
Name Type Description
0 Array.<Topic>

Array of Topic instances.

1 object

The full API response.

MessageOptions :object

Properties:
Name Type Attributes Description
data buffer <optional>

The message data.

json object <optional>

Convenience property to publish JSON data. This will transform the provided JSON into a Buffer before publishing. Subscription objects will always return message data in the form of a Buffer, so any JSON published will require manual deserialization.

attributes object.<string, string> <optional>

Attributes for this message.

orderingKey string <optional>

A message ordering key.

MessageStreamOptions :object

Properties:
Name Type Attributes Default Description
highWaterMark number <optional>
0

Configures the Buffer level for all underlying streams. See https://nodejs.org/en/docs/guides/backpressuring-in-streams/ for more details.

maxStreams number <optional>
5

Number of streaming connections to make.

timeout number <optional>
300000

Timeout for establishing a connection.

ModifyPushConfigCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

ModifyPushConfigResponse :array

Properties:
Name Type Description
0 object

The full API response.

PermissionsResponse :Array.<string>

A subset of TestPermissionsRequest.permissions that the caller is allowed.

See:

SeekCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

SeekResponse :array

Properties:
Name Type Description
0 object

The full API response.

SetPolicyCallback(errnullable, acl)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

acl object

The policy.

SetPolicyResponse :array

Properties:
Name Type Description
0 object

The policy.

SetSubscriptionMetadataCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

SetSubscriptionMetadataResponse :array

Properties:
Name Type Description
0 object

The full API response.

SetTopicMetadataCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

SetTopicMetadataResponse :array

Properties:
Name Type Description
0 object

The full API response.

SubscriberOptions :object

Properties:
Name Type Attributes Default Description
ackDeadline number <optional>
10

Acknowledge deadline in seconds. If left unset the initial value will be 10 seconds, but it will evolve into the 99th percentile time it takes to acknowledge a message.

batching BatchOptions <optional>

Request batching options.

flowControl FlowControlOptions <optional>

Flow control options.

streamingOptions MessageStreamOptions <optional>

Streaming options.

SubscriptionDetachedCallback(errnullable, exists)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

exists boolean

Whether the subscription is detached.

SubscriptionDetachedResponse :array

Properties:
Name Type Description
0 boolean

Whether the subscription is detached.

SubscriptionExistsCallback(errnullable, exists)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

exists boolean

Whether the subscription exists.

SubscriptionExistsResponse :array

Properties:
Name Type Description
0 boolean

Whether the subscription exists

TestIamPermissionsCallback(errnullable, permissions, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

permissions TestIamPermissionsAPIResponse

A subset of permissions that the caller is allowed.

apiResponse PermissionsResponse

The full API response.

TestIamPermissionsResponse :array

Properties:
Name Type Description
0 Array.<object>

A subset of permissions that the caller is allowed.

1 PermissionsResponse

The full API response.

TopicExistsCallback(errnullable, exists)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

exists boolean

Whether the topic exists.

TopicExistsResponse :array

Properties:
Name Type Description
0 boolean

Whether the topic exists