Skip to main content

topics

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

Overview

Nametopics
TypeResource
Idgoogle.pubsublite.topics

Fields

NameDatatypeDescription
namestringThe name of the topic. Structured like: projects/{project_number}/locations/{location}/topics/{topic_id}
partitionConfigobjectThe settings for a topic's partitions.
reservationConfigobjectThe settings for this topic's Reservation usage.
retentionConfigobjectThe settings for a topic's message retention.

Methods

NameAccessible byRequired ParamsDescription
admin_projects_locations_reservations_topics_listSELECTlocationsId, projectsId, reservationsIdLists the topics attached to the specified reservation.
admin_projects_locations_topics_getSELECTlocationsId, projectsId, topicsIdReturns the topic configuration.
admin_projects_locations_topics_listSELECTlocationsId, projectsIdReturns the list of topics for the given project.
admin_projects_locations_topics_createINSERTlocationsId, projectsIdCreates a new topic.
admin_projects_locations_topics_deleteDELETElocationsId, projectsId, topicsIdDeletes the specified topic.
admin_projects_locations_topics_patchUPDATElocationsId, projectsId, topicsIdUpdates properties of the specified topic.
topic_stats_projects_locations_topics_compute_head_cursorEXEClocationsId, projectsId, 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_statsEXEClocationsId, projectsId, topicsIdCompute statistics about a range of messages in a given topic and partition.
topic_stats_projects_locations_topics_compute_time_cursorEXEClocationsId, projectsId, topicsIdCompute the corresponding cursor for a publish or event time in a topic partition.

SELECT examples

Returns the list of topics for the given project.

SELECT
name,
partitionConfig,
reservationConfig,
retentionConfig
FROM google.pubsublite.topics
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new topics resource.

/*+ create */
INSERT INTO google.pubsublite.topics (
locationsId,
projectsId,
name,
partitionConfig,
retentionConfig,
reservationConfig
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ partitionConfig }}',
'{{ retentionConfig }}',
'{{ reservationConfig }}'
;

UPDATE example

Updates a topics resource.

/*+ update */
UPDATE google.pubsublite.topics
SET
name = '{{ name }}',
partitionConfig = '{{ partitionConfig }}',
retentionConfig = '{{ retentionConfig }}',
reservationConfig = '{{ reservationConfig }}'
WHERE
locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND topicsId = '{{ topicsId }}';

DELETE example

Deletes the specified topics resource.

/*+ delete */
DELETE FROM google.pubsublite.topics
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND topicsId = '{{ topicsId }}';