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:

Successful response

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

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
admin_projects_locations_topics_getselectprojectsId, locationsId, topicsIdReturns the topic configuration.
admin_projects_locations_reservations_topics_listselectprojectsId, locationsId, reservationsIdpageSize, pageTokenLists the topics attached to the specified reservation.
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_message_statsexecprojectsId, locationsId, topicsIdCompute statistics about a range of messages in a given topic and partition.
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_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

Returns the topic configuration.

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

INSERT examples

Creates a new topic.

INSERT INTO google.pubsublite.topics (
data__name,
data__partitionConfig,
data__retentionConfig,
data__reservationConfig,
projectsId,
locationsId,
topicId
)
SELECT
'{{ name }}',
'{{ partitionConfig }}',
'{{ retentionConfig }}',
'{{ reservationConfig }}',
'{{ 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__retentionConfig = '{{ retentionConfig }}',
data__reservationConfig = '{{ reservationConfig }}'
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 statistics about a range of messages in a given topic and partition.

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