Tutti gli esempi di codice Pub/Sub Lite

Mantieni tutto organizzato con le raccolte Salva e classifica i contenuti in base alle tue preferenze.

This page contains code samples for Pub/Sub Lite. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.

Create a Lite subscription that writes messages to a Pub/Sub topic

Create a Lite subscription that writes messages to a Pub/Sub topic

Create Lite Reservation

Create a Pub/Sub Lite reservation

View in documentation

Create Lite subscription

Create a Lite subscription with a chosen delivery mode.

View in documentation

Create Lite topic

Create a single-partition Lite topic and configure its retention period, per partition storage, and publishing throughput scaling factor.

View in documentation

Delete Lite Reservation

Delete a Pub/Sub Lite reservation

View in documentation

Delete Lite subscription

Delete a Lite subscription.

View in documentation

Delete Lite topic

Delete a Lite topic.

View in documentation

Get Lite Reservation

Get a Pub/Sub Lite Reservation

View in documentation

Get Lite subscription

Print name, topic path, and delivery config of a Lite subscription.

View in documentation

Get Lite topic

Print name, retention config, and partition config of a Lite topic.

View in documentation

List Lite Reservations

Lite Pub/Sub Lite reservations

View in documentation

List Lite subscriptions in project

List Lite subscriptions in a project.

View in documentation

List Lite subscriptions in topic

List Lite subscriptions in a Lite topic.

View in documentation

List Lite topics

List Lite topics in a project.

View in documentation

Publish

Publish messages to a single-partition Lite topic and resolve the publish futures asynchronously.

Publish messages from Apache Kafka

Publish messages to a Pub/Sub Lite topic using a shim for the Kafka Producer API

Publish with batch settings

Publish messages with batch settings.

View in documentation

Publish with custom attributes

Publish messages with custom attributes.

View in documentation

Publish with ordering keys

Publish messages with an ordering key. Ordering keys are hashed to map to a partition. Messages of the same ordering key get published to the same partition. If the partition is filled up, oldest messages get written over.

View in documentation

Read from Pub/Sub Lite from Spark (streaming)

Read messages from a Pub/Sub Lite subscription from a Spark cluster in the streaming mode.

Receive messages in Apache Kafka

Receive messages from a Pub/Sub Lite subscription using a shim for the Kafka Consumer API

Seek to a location in a Pub/Sub Lite subscription

Seek to a location in a Pub/Sub Lite subscription to start receiving messages from that location.

Stream Pub/Sub Lite to Cloud Storage using Dataflow

This sample shows how to create an Apache Beam streaming pipeline that reads messages from Pub/Sub Lite, group the messages using a fixed-sized windowing function, and writes them to Cloud Storage.

Subscribe

Use a multi-partition and flow-controlled subscriber (a collection of subscribers) to subscribe to a multiple-partition topic and process messages asynchronously in callbacks.

Update Lite Reservation

Update a Pub/Sub Lite reservation

View in documentation

Update Lite subscription

Update the delivery mode of a Lite subscription.

View in documentation

Update Lite topic

Update the retention period, the scaling factor (throughput capacity), and per partition bytes (storage capacity) of a Lite topic.

View in documentation

Write to Pub/Sub Lite from Spark (streaming)

Write messages to a Pub/Sub Lite topic from a Spark cluster in the streaming mode.