Skip to main content

subscriptions

Creates, updates, deletes, gets or lists a subscriptions resource.

Overview​

Namesubscriptions
TypeResource
Idgoogle.pubsublite.subscriptions

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the subscription. Structured like: projects/{project_number}/locations/{location}/subscriptions/{subscription_id}
deliveryConfigobjectThe settings for this subscription's message delivery. (id: DeliveryConfig)
exportConfigobjectIf present, messages are automatically written from the Pub/Sub Lite topic associated with this subscription to a destination. (id: ExportConfig)
topicstringThe name of the topic this subscription is attached to. Structured like: projects/{project_number}/locations/{location}/topics/{topic_id}

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
admin_projects_locations_subscriptions_getselectprojectsId, locationsId, subscriptionsIdReturns the subscription configuration.
admin_projects_locations_topics_subscriptions_listselectprojectsId, locationsId, topicsIdpageSize, pageTokenLists the subscriptions attached to the specified topic.
admin_projects_locations_subscriptions_listselectprojectsId, locationsIdpageSize, pageTokenReturns the list of subscriptions for the given project.
admin_projects_locations_subscriptions_createinsertprojectsId, locationsIdskipBacklog, subscriptionIdCreates a new subscription.
admin_projects_locations_subscriptions_patchupdateprojectsId, locationsId, subscriptionsIdupdateMaskUpdates properties of the specified subscription.
admin_projects_locations_subscriptions_deletedeleteprojectsId, locationsId, subscriptionsIdDeletes the specified subscription.
admin_projects_locations_subscriptions_seekexecprojectsId, locationsId, subscriptionsIdPerforms an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors. If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients. If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online. If the previous seek operation has not yet completed, it will be aborted and the new invocation of seek will supersede it.
cursor_projects_locations_subscriptions_commit_cursorexecprojectsId, locationsId, subscriptionsIdUpdates the committed cursor.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
projectsIdstring
subscriptionsIdstring
topicsIdstring
pageSizeinteger (int32)
pageTokenstring
skipBacklogboolean
subscriptionIdstring
updateMaskstring (google-fieldmask)

SELECT examples​

Returns the subscription configuration.

SELECT
name,
deliveryConfig,
exportConfig,
topic
FROM google.pubsublite.subscriptions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND subscriptionsId = '{{ subscriptionsId }}' -- required
;

INSERT examples​

Creates a new subscription.

INSERT INTO google.pubsublite.subscriptions (
data__deliveryConfig,
data__exportConfig,
data__name,
data__topic,
projectsId,
locationsId,
skipBacklog,
subscriptionId
)
SELECT
'{{ deliveryConfig }}',
'{{ exportConfig }}',
'{{ name }}',
'{{ topic }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ skipBacklog }}',
'{{ subscriptionId }}'
RETURNING
name,
deliveryConfig,
exportConfig,
topic
;

UPDATE examples​

Updates properties of the specified subscription.

UPDATE google.pubsublite.subscriptions
SET
data__deliveryConfig = '{{ deliveryConfig }}',
data__exportConfig = '{{ exportConfig }}',
data__name = '{{ name }}',
data__topic = '{{ topic }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND subscriptionsId = '{{ subscriptionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
deliveryConfig,
exportConfig,
topic;

DELETE examples​

Deletes the specified subscription.

DELETE FROM google.pubsublite.subscriptions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND subscriptionsId = '{{ subscriptionsId }}' --required
;

Lifecycle Methods​

Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors. If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients. If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online. If the previous seek operation has not yet completed, it will be aborted and the new invocation of seek will supersede it.

EXEC google.pubsublite.subscriptions.admin_projects_locations_subscriptions_seek
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@subscriptionsId='{{ subscriptionsId }}' --required
@@json=
'{
"namedTarget": "{{ namedTarget }}",
"timeTarget": "{{ timeTarget }}"
}'
;