---
sidebar_position: 60
description: How to configure a Google Cloud PubSub exporter.
---
import { integrations } from "@site/data/integrations";
import {Mandatory, NotMandatory} from "@site/src/components/checks/checks";
export const exporterName = 'Google Cloud PubSub'
export const info = integrations.exporters.find((r) => r.name === exporterName)

# GCP PubSub

## Overview
{info.longDescription ?? info.description}

:::info
{exporterName} is an exporter of type queue, it means that it send events as soon as he receives them it does not work in bulk but in near real time.
:::
## Configure the relay proxy

To configure your relay proxy to use the {exporterName} exporter, you need to add the following
configuration to your relay proxy configuration file:

```yaml title="goff-proxy.yaml"
# ...
exporter:
  kind: pubsub
  projectID: "my-project-id"
  topic: "goff-feature-events"
# ...
```

| Field name  |   Mandatory   | Type   | Default  | Description                                                                                              |
|-------------|:-------------:|--------|----------|----------------------------------------------------------------------------------------------------------|
| `kind`      | <Mandatory /> | string | **none** | **Value should be `pubsub`**.<br/>_This field is mandatory and describes which retriever you are using._ |
| `projectID` | <Mandatory /> | string | **none** | Value should be ID of GCP project you are using.                                                         |
| `topic`     | <Mandatory /> | string | **none** | Topic name on which messages will be published.                                                          |

## Configure the GO Module
To configure your GO module to use the {exporterName} exporter, you need to add the following
configuration to your `ffclient.Config{}` object:

```go title="example.go"
config := ffclient.Config{
   // ...
    DataExporter: ffclient.DataExporter{
        // ...
        Exporter: &pubsubexporter.Exporter{
            ProjectID: "project-id", // required
            Topic: "topic", // required
            Options: []option.ClientOption{...},
            PublishSettings: &pubsub.PublishSettings{...},
            EnableMessageOrdering: true,
        },
    },
    // ...
}
err := ffclient.Init(config)
defer ffclient.Close()
```

| Field                   |    Mandatory     | Description                                                                                          |
|-------------------------|:----------------:|------------------------------------------------------------------------------------------------------|
| `ProjectID `            |  <Mandatory />   | ID of GCP project.<br/>_You can find it in your GCP console_                                         |
| `Topic `                |  <Mandatory />   | Name of topic on which messages will be published                                                    |
| `Options`               | <NotMandatory /> | PubSub client options *(see [docs](https://pkg.go.dev/google.golang.org/api/option))*                |
| `PublishSettings`       | <NotMandatory /> | Topic related settings *(see [docs](https://pkg.go.dev/cloud.google.com/go/pubsub#PublishSettings))* |
| `EnableMessageOrdering` | <NotMandatory /> | Enables delivery of ordered keys                                                                     |
