# Pub/Sub

## Add a Pub/Sub topic

1. From the DuploCloud Portal, navigate to **Cloud Services** -> **Pub/Sub**.
2. Select the **Topics** tab, and click **Add**. The **Create a PubSub Topic** pane displays.<br>

   <div align="left"><figure><img src="/files/ssLWQtsg5wfBjmMDomJv" alt=""><figcaption><p>The <strong>Create a PubSub Topic</strong> pane</p></figcaption></figure></div>
3. Provide a **Name** for the Pub/Sub Topic.
4. Enter necessary labels in the **Labels** field, (e.g., `env: production`).
5. Click **Create**. The Pub/Sub topic is created.

## Create a Pub/Sub Topic Subscription

1. From the DuploCloud Portal, navigate to **Cloud Services** -> **Pub/Sub**.
2. Select the **Subscriptions** tab, and click **Add**. The **Create Subscription** pane displays.

<figure><img src="/files/P5m1HMeIJekR38rFFrsP" alt=""><figcaption><p>The <strong>Create Subscription</strong> pane in the DuploCloud Portal</p></figcaption></figure>

3. Provide a **Name** for the subscription.
4. Select the Pub/Sub topic for reference from the **Topic** list box.
5. From the **Delivery Type** list box, select one of these options:
   * **Pull**: Allows the subscriber to manually pull messages from the subscription at their own pace.
   * **Push**: Automatically pushes messages to a specified endpoint (e.g., HTTP server or API) as soon as they are published to the topic.
   * **BigQuery**: Delivers messages directly to a Google BigQuery table for analytics and data processing.
   * **Cloud Storage**: Sends messages to a specified Cloud Storage bucket, storing them as objects for later retrieval or processing.
6. Adjust the **Acknowledgement Deadline (seconds)**, if needed. This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message.
7. Complete additional required fields depending on the **Delivery Type**:
   * **Pull**
     * No additional fields required.
   * **Push**
     * **Endpoint**: Enter the URL to which the messages will be sent.
     * **Attributes** (Optional): Define any optional key-value attributes to be included in the push request.
   * **BigQuery**
     * **Table Name**: Specify the name of the BigQuery table where messages will be stored.
     * **Schema**: Select the schema for the table to structure the data appropriately.
     * Optionally enable **Write Metadata** or **Drop Unknown Fields**.
   * **Cloud Storage**
     * **Bucket**: Enter the name of the Cloud Storage bucket where the messages will be stored as objects.

<figure><img src="/files/oYoychZtbJ2vydpRGvW4" alt=""><figcaption><p>The filled <strong>Create Subscription</strong> pane</p></figcaption></figure>

8. Click **Create**. The subscription is displayed on the **Subscriptions** tab.

<figure><img src="/files/LciGp8mugzLefT71vF8S" alt=""><figcaption><p>The <strong>Pub/Su</strong>b <strong>Subscriptions</strong> page in the DuploCloud Portal</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.duplocloud.com/docs/automation-platform/overview-1/gcp-services/s3-bucket-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
