A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/pubsub/docs/publish-message-overview below:

Publish message overview | Pub/Sub Documentation

Publish message overview

Stay organized with collections Save and categorize content based on your preferences.

To publish a message with Pub/Sub, a publisher application creates and sends messages to a topic.

This document provides an overview about the publish workflow, including the concept of topics and messages.

About topics

A Pub/Sub topic is a named resource that represents a feed of messages. When a publisher sends a message, it targets a specific topic. The Pub/Sub service uses this topic name to route the message to all subscriptions attached to the topic. If there are multiple subscribers for a subscription, only one subscriber in the subscription receives the message.

Publishers don't have to know how many subscribers exist. They focus on the topic, ensuring the separation of concerns between message sending and message receiving.

Pub/Sub supports two kinds of topics: a standard topic and an import topic.

Properties of a topic

When you create or update a topic, you can specify the topic properties.

For more information about the topic properties, see Properties of a topic.

About import topics

An import topic lets Pub/Sub ingest streaming data from another source and act as the publisher application that sends the data to the topic. You can enable ingestion on a topic by using the console, Google Cloud CLI, REST calls, or the client libraries. As part of managing the import topic, Google Cloud provides monitoring and scaling of the ingestion pipeline.

Without an import topic, streaming data into Pub/Sub from a data source requires an additional service. This additional service pulls data from the original source and publishes it to Pub/Sub. The additional service can be a streaming engine such as Apache Spark or a custom-written service. You must also configure, deploy, run, scale, and monitor this service.

The following is a list of important information regarding import topics:

We recommend import topics for streaming data. If you are considering batch data ingestion into BigQuery instead of streaming data ingestion, you can try BigQuery Data Transfer Service. If you want to ingest data into Cloud Storage, Storage Transfer Service (STS) is a good option.

Pub/Sub supports the following sources for import topics:

Data replication in a topic

A Pub/Sub topic uses three zones to store data. The service supports synchronous replication to at least two zones, and best-effort replication to an additional third zone. Pub/Sub replication is within just one region.

About messages

A Pub/Sub message is the data that moves through the service.

A message consists of fields with the message data and metadata. One of the following must be specified in a message.

The Pub/Sub service adds the following fields to the message:

For example, here is a message format in JSON:

{
  "data": "This is the core message content.",
  "attributes": {
    "category": "notification",
    "user_id": "12345",
    "priority": "medium"
  },
    "orderingKey": "12345"
}

When publishing messages using Pub/Sub client libraries, provide the message data as a byte array, such as a Node.js Buffer. If your data is a string, you must first encode it to bytes, for example by using UTF-8 encoding, before passing it to the client library.

If you're using the REST API directly, the message data must be base64-encoded and sent as a string.

Publish message workflow

To publish a message with Pub/Sub, a publisher application creates and sends messages to a topic.

  1. Create a message containing your data.
  2. Select any optional publishing attributes.
  3. Send a request to the Pub/Sub server to publish the message to a specified topic.
  4. The Pub/Sub service receives the message and processes it as follows:

Pub/Sub offers at-least-once message delivery and best-effort ordering to existing subscribers.

For more information about the Pub/Sub system, see Overview of the Pub/Sub service.

For more information about how Pub/Sub works, see Architectural overview of Pub/Sub.

What's next

Apache Kafka® is a registered trademark of The Apache Software Foundation or its affiliates in the United States and/or other countries.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4