Quickstart: using the console

This page shows you how to perform basic tasks in Cloud Pub/Sub using the Google Cloud Platform Console.

Before you begin

  1. Accede a tu Cuenta de Google.

    Si todavía no tienes una cuenta, regístrate para obtener una nueva.

  2. Configurar un proyecto de GCP Console.

    Configurar un proyecto

    Haz clic para realizar alguna de las siguientes acciones:

    • Crear o seleccionar un proyecto.
    • Habilitar las Cloud Pub/Sub API necesarias para el proyecto.

    Puedes visualizar y administrar estos recursos en GCP Console en cualquier momento.

  3. Realiza la instalación y la inicialización del SDK de Cloud.

Create a topic

  1. Go to the Cloud Pub/Sub topics page in the GCP Console.

    Go to the Cloud Pub/Sub topics page

  2. Click Create a topic.

    Screenshot that shows the Create a topic dialog in the console

  3. Enter a unique Name for your topic, for example, MyTopic.

That's it—you've just created a Cloud Pub/Sub topic!

Add a subscription

To add a subscription to the topic you just created:

  1. Display the menu for the topic you just created, and click New subscription.

    Screenshot of the console dialog that shows the New subscription
          button in the row for the topic.

  2. Type a name for the subscription, such as MySub.

    Shows the new subscription dialog and typing your subscription
          name in the Subscription name field.

  3. Leave the delivery type as Pull.

  4. Click Create.

Publish a message to the topic

To publish a message to the topic:

  1. In the overflow menu for the topic you just created, click Publish Message.
  2. Enter Hello World in the Message field.
  3. Click Publish.

Pull the message from the subscription

To receive the message you just published, your subscription needs to perform a pull operation. One way to do this is through the gcloud command-line tool. You can use the Cloud SDK you installed in Before you begin. Alternately, you can use the Cloud Shell to run the following gcloud command:

    gcloud pubsub subscriptions pull --auto-ack MySub

The message you sent appears in the DATA field of the command output.

How did it go?

Note that additional resources and links are available on the Cloud Pub/Sub support page.

Clean up

To avoid incurring charges to your GCP account for the resources used in this quickstart:

  1. Go to the Cloud Pub/Sub topics page in the GCP Console.

    Go to the Cloud Pub/Sub topics page

  2. Check the checkbox next to the topic that you created.

  3. Click Delete to permanently delete the topic.

  4. Delete any remaining subscriptions by displaying each subscription and clicking its trash can icon.

What's next

Get started with Cloud Pub/Sub in your language of choice at Cloud Pub/Sub Client Libraries.

See the Publisher and Subscriber guides to learn more about the concepts discussed in this page.

For a detailed overview of Cloud Pub/Sub, see What is Cloud Pub/Sub?

¿Te sirvió esta página? Envíanos tu opinión:

Enviar comentarios sobre…

Cloud Pub/Sub Documentation