Browse the docs

Add storage and events

Declare a bucket or an event topic with your service. The platform creates it when it deploys the service. Your code uses the logical name and carries no provider name or credential.

What happens in the cloud

  1. You declare buckets and events in infra/requirements.json. The release set carries the declaration.
  2. At deploy, the platform creates each bucket you declared, or reuses the one it recorded for that service and name.
  3. The platform creates or updates each event topic your service publishes or subscribes to, before the new revision exists.
  4. It starts the revision with access to the buckets at the level you declared. The resolved config holds the bucket binding, and no credential.
  5. When the revision serves, the platform creates the push subscriptions you declared.

Each service deploys on its own. A failure in one service leaves the others running.

Do it

Declare a bucket

{
  "$schema": "https://putnami.dev/schemas/putnami-infra.json",
  "protocolVersion": 2,
  "storage": [
    { "name": "uploads", "access": "readwrite" }
  ]
}

name is the stable identity that your code resolves. Keep it stable across releases.

Declare events

Add an events block to the same file:

{
  "events": {
    "publishes": ["order.created"],
    "subscribes": [
      "order.cancelled",
      { "topic": "order.shipped", "delivery": "push" }
    ]
  }
}

A topic name alone is a pull subscription. The delivery field takes pull, stream or push.

There is no CLI command for topics. Each deploy converges them.

Change a declaration

Change Result
Deploy the same declaration again The platform reuses the recorded bucket.
Add a bucket name The platform creates another bucket.
Change application code only The bucket stays.
Rename or remove a bucket name A new name is a new bucket. The old data does not move. Plan the data migration yourself.

A deploy never infers that two different names hold the same data.

What you see

Open Events in the menu of putnami.app. It lists every topic and subscription the platform created for the services of your workspaces, in every environment. Any member of the workspace reads the topics. The backlog, oldest unacknowledged message and dead-letter columns need the role permission platform.observability.read. Without it they read "—".

Section Shows
Needs attention A service whose last event setup failed. A push subscription with messages in dead letters, or a message unacknowledged for more than 5 minutes. A topic received but published by no service. A topic published but received by none.
Topics Each topic, with its publishers, receivers, backlog, oldest unacknowledged message, dead letters and health.
Subscriptions Each receive of a topic by a service.
Convergence For each service, the outcome of its last event setup, when it last succeeded and failed, and the failure code.

Filter by workspace, environment, health, service or topic. The address keeps the filters, so you can share a filtered page.

A topic opens its own page: the flow from its publishers to its receivers, and for each push subscription the acknowledgement deadline, the maximum delivery attempts and the dead-letter topic. A service page has an Events tab for what the service publishes and receives. Open in Events narrows the Events page to that service.

A push subscription shows its own backlog and dead letters. A pull or stream receive has no backlog of its own: the page says via Event Server.

The page is read-only. Redrive, pause, replay and test publishes are not available. A service keeps its row after it stops declaring events.

When it fails

You see Cause Fix
A service has no topic on the Events page The service has not deployed since you declared events. Merge and wait for the deploy.
Needs attention shows a failed setup The last deploy could not create a topic or subscription. Read the failure code in Convergence. Run putnami cloud deploy status <cm_id>.
Dead letters grow on a push subscription Your service refuses or fails the delivery. Read the logs of the service. See Debug a service.
A bucket is empty after a rename The new name is a new bucket. Copy the data yourself, or restore the old name.
The page says a workspace cannot be read The platform could not read its events. The other workspaces still show. Open the page again. Sign in again if your session expired.

Next