Skip to main content

topics

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

Overview​

Nametopics
TypeResource
Idgoogle.pubsublite.topics

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
admin_projects_locations_reservations_topics_listselectprojectsId, locationsId, reservationsIdpageSize, pageTokenLists the topics attached to the specified reservation.
admin_projects_locations_topics_getselectprojectsId, locationsId, topicsIdReturns the topic configuration.
admin_projects_locations_topics_listselectprojectsId, locationsIdpageSize, pageTokenReturns the list of topics for the given project.
admin_projects_locations_topics_createinsertprojectsId, locationsIdtopicIdCreates a new topic.
admin_projects_locations_topics_patchupdateprojectsId, locationsId, topicsIdupdateMaskUpdates properties of the specified topic.
admin_projects_locations_topics_deletedeleteprojectsId, locationsId, topicsIdDeletes the specified topic.
topic_stats_projects_locations_topics_compute_head_cursorexecprojectsId, locationsId, topicsIdCompute the head cursor for the partition. The head cursor's offset is guaranteed to be less than or equal to all messages which have not yet been acknowledged as published, and greater than the offset of any message whose publish has already been acknowledged. It is zero if there have never been messages in the partition.
topic_stats_projects_locations_topics_compute_message_statsexecprojectsId, locationsId, topicsIdCompute statistics about a range of messages in a given topic and partition.
topic_stats_projects_locations_topics_compute_time_cursorexecprojectsId, locationsId, topicsIdCompute the corresponding cursor for a publish or event time in a topic partition.

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
reservationsIdstring
topicsIdstring
pageSizeinteger (int32)
pageTokenstring
topicIdstring
updateMaskstring (google-fieldmask)

SELECT examples​

Lists the topics attached to the specified reservation.

SELECT
*
FROM google.pubsublite.topics
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND reservationsId = '{{ reservationsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;

INSERT examples​

Creates a new topic.

INSERT INTO google.pubsublite.topics (
data__name,
data__partitionConfig,
data__reservationConfig,
data__retentionConfig,
projectsId,
locationsId,
topicId
)
SELECT
'{{ name }}',
'{{ partitionConfig }}',
'{{ reservationConfig }}',
'{{ retentionConfig }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ topicId }}'
RETURNING
name,
partitionConfig,
reservationConfig,
retentionConfig
;

UPDATE examples​

Updates properties of the specified topic.

UPDATE google.pubsublite.topics
SET
data__name = '{{ name }}',
data__partitionConfig = '{{ partitionConfig }}',
data__reservationConfig = '{{ reservationConfig }}',
data__retentionConfig = '{{ retentionConfig }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND topicsId = '{{ topicsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
partitionConfig,
reservationConfig,
retentionConfig;

DELETE examples​

Deletes the specified topic.

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

Lifecycle Methods​

Compute the head cursor for the partition. The head cursor's offset is guaranteed to be less than or equal to all messages which have not yet been acknowledged as published, and greater than the offset of any message whose publish has already been acknowledged. It is zero if there have never been messages in the partition.

EXEC google.pubsublite.topics.topic_stats_projects_locations_topics_compute_head_cursor
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@topicsId='{{ topicsId }}' --required
@@json=
'{
"partition": "{{ partition }}"
}'
;