> For the complete documentation index, see [llms.txt](https://docs.pandium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pandium.com/getting-started/integration-patterns/pubsub.md).

# PubSub

The pub/sub integration pattern: consuming a third-party platform's event stream from a message broker such as Google Pub/Sub, Amazon EventBridge, or Kafka, and how it fits on Pandium.

PubSub is the least common of the six patterns, rare enough that most integrations will never need it. Instead of catching individual webhooks one at a time at an HTTP endpoint, you subscribe to a message broker and consume the stream of events flowing through it.

<figure><img src="https://4017407078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfJn-9R_dn6dvcGNcdk%2Fuploads%2Fgit-blob-d50a7debfb3ee384e5ac88bdc5484233e7c9432c%2F06-pubsub.png?alt=media" alt="A partner platform publishes events to a message broker; a consumer on Pandium pulls batches, processes them, acknowledges, and updates your API"><figcaption></figcaption></figure>

## How it works

A few platforms can deliver their events to a broker instead of, or as well as, an HTTP webhook URL. Shopify, for example, can send webhook topics to Google Pub/Sub or Amazon EventBridge. Others expose a Kafka topic directly. In every case the broker holds each message until a consumer acknowledges it, so a consumer that is down for an hour comes back to a backlog rather than a gap.

On Pandium, the consumer is usually a scheduled integration run on a tight interval. Each run pulls a batch of messages from the subscription, processes them, acknowledges what it handled, and exits. Because the broker is durable and the run is idempotent (it must be, since at-least-once delivery means the occasional duplicate), this gives most of the benefit of a streaming consumer without an always-on process. For genuinely high-volume streams where seconds matter, Pandium can host a long-running consumer service instead. [Contact us](mailto:support@pandium.com) if that is what you need.

## Strengths and trade-offs

A broker decouples the system publishing events from everything consuming them. Messages wait in the queue instead of disappearing when a consumer is unavailable, delivery is at least once, and most brokers let you replay from a point in time. Backpressure is handled for you: a burst of events becomes a longer queue, not a flood of HTTP retries against your endpoint.

The cost is real infrastructure to set up and maintain on the platform side, and more moving parts than a webhook or batch integration. Not every platform offers a broker, so this pattern is tool-specific. When something looks wrong, tracing it is harder, because the path runs through the broker rather than a single request you can see in a log.

## When to use it

Use PubSub when the platform offers it and volume is genuinely high, high enough that a single webhook endpoint would struggle to keep up or you cannot afford dropped and duplicated events. Once it is set up, it is about as reliable as batch.

## Real-world examples

* A high-volume Shopify merchant whose order and inventory events arrive through Google Pub/Sub, drained every minute into an ERP
* A platform that publishes every customer change to a Kafka topic, consumed in batches to keep a CRM current

## Related reading

* [Webhooks](https://docs.pandium.com/getting-started/integration-patterns/webhooks.md)
* [Batch and API-Triggered Syncs](https://docs.pandium.com/getting-started/integration-patterns/batch-and-api-triggered-syncs.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pandium.com/getting-started/integration-patterns/pubsub.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
