Skip to Content

Poll Mode

Poll Mode

In poll mode, your application polls for messages from a queue on its own schedule instead of having Vercel invoke your function. This gives you full control over when and how messages are consumed.

When to use poll mode

Poll mode is designed for two main scenarios:

Consuming off Vercel

If your consumers run outside of Vercel (on long-running services, on-premise workers, or other cloud environments), poll mode lets you connect to Vercel Queues without requiring Vercel Functions. Your application polls the queue and processes messages whenever it's ready.

This makes Vercel Queues a cross-platform messaging layer: publish messages from your Vercel app and process them wherever your infrastructure runs.

Advanced on-Vercel setups

On Vercel, push mode is the default and handles most workloads. However, poll mode is available on Vercel for cases where you need more control over consumption.

Common patterns include:

  • Cron-triggered processing: Use a Vercel Cron Job to invoke a function on a schedule that polls the queue and processes messages in batch.
  • Client-driven polling: Have your client-side application poll a server endpoint, which then polls the queue on behalf of that client. This is useful for building real-time experiences without persistent connections.
  • Rate-controlled consumption: Poll for messages at a pace that matches a downstream dependency's rate limits.
  • Mixed delivery: Use push mode for latency-sensitive consumers and poll mode for batch workloads within the same application and even the same queue.

Example: multiplayer AI agent replay

Consumer groups are a natural fit for multiplayer AI workflows. Consider a remote coding agent that multiple developers can observe in real time. Each action the agent takes (file edits, terminal commands, tool calls) is published to a topic. Every connected viewer gets their own consumer group and replays the full action history from the beginning.

This works because new consumer groups always start at the beginning of the topic. A developer who joins mid-session doesn't miss anything. Their consumer group replays every action from the start, then catches up to the live stream. Developers who have been watching the whole time continue receiving new actions without interruption.

The agent publishes actions as they happen, and each viewer's consumer group independently tracks how far through the action log they've read. Because consumer groups are unlimited, this scales to any number of simultaneous viewers without affecting the agent or other observers.

PollingQueueClient

Use PollingQueueClient from the @vercel/queue SDK to poll for messages. It provides send and receive methods. For Python polling, see the Python SDK Reference.

The region parameter is required because messages can only be received from the region they were sent to:

Receiving messages

Call receive with a topic, consumer group, and handler callback. Messages are automatically acknowledged when your handler completes, and retried if it throws:

Vercel retries messages that aren't acknowledged according to the same retry behavior as push mode. Delivery guarantees are identical regardless of which mode you use.

Receive options

Option

cursorFallback controls where polling starts when a source shard has no cursor for the consumer group. It does not move or reset an existing cursor.

limit

visibilityTimeoutSeconds number

cursorFallback

Cursor fallback behavior
  • Type
  • number
  • string
  • "earliest" | "latest"

Default

1 5 minutes

"earliest"

Start Now
  • Description
  • How long received messages are hidden from other consumers
  • Receive a specific message by ID
  • Starting position for a missing consumer group cursor
  • -
  • "earliest" starts at the earliest retained message. This is the default and lets a new consumer group replay available backlog.
  • "latest" starts after each missing shard's committed head. Use this when a consumer should process new messages without replaying retained backlog.

Vercel discovers source shards as it polls and initializes missing cursors when it encounters them. With "latest", each cursor starts after that shard's feeder-committed head at the time the shard is observed. Active shards are typically encountered during the initial polling requests; once a shard has a cursor, later polls continue from that cursor rather than applying the fallback again. Messages buffered above an observed shard head remain eligible for delivery.

This initialization is per shard rather than a single topic-wide cutoff.

For example, use "latest" when a newly deployed worker should skip messages retained before each shard is first discovered:

The option applies to the current receive request. If multiple workers share a consumer group, configure them to send the same cursorFallback value. Existing shard cursors continue from their current positions and are never moved, even if a later request uses a different value. During startup, a consumer group can briefly have some shards using existing positions while newly encountered shards are initialized at their latest committed heads.

Versioning with deployment IDs

On Vercel, topics are partitioned by deployment ID by default, so each deployment produces and consumes its own messages. In poll mode, you have two options for handling versioning:

  • Use the deployment ID: Reference the deployment ID as an opaque version identifier when polling. This gives you the same per-deployment isolation as push mode, where each version of your application processes only the messages it published.
  • Omit the deployment ID: Poll across all deployments and handle versioning at the application level. This is useful when your off-platform consumer needs to process messages from any deployment, or when your message schema is stable and backward-compatible.

With deployment ID (isolated per-deployment):

Vqs-Deployment-Id: dpl_abc123

POST https://iad1.vercel-queue.com/api/v3/topic/orders/consumer/fulfillment

Without deployment ID (all deployments share the queue):

POST https://iad1.vercel-queue.com/api/v3/topic/orders/consumer/fulfillment


Delivery

Consumer groups are not scoped to a service. A group is identified only by its name on a topic, shared across the whole project and deployment rather than isolated per service.

Workloads on Vercel with fluid compute

Best for

Your app polls for messages
Poll mode
Off-platform consumers, batch processing
At-least-once

Scaling

Latency

Vercel invokes your function
Managed by your application
Depends on your polling interval
Lower (messages delivered as they arrive)

Poll mode in services

When consumers in different services poll the same topic, scope their consumer group names manually to prevent collisions across services.

Push mode
Delivery guarantees
Automatic with fluid compute
At-least-once

Last updated September 17, 2026

Cross-link map: Poll Mode (/docs/queues/poll-mode)From the Vercel docs graph (built 2026-09-21T05:26:59.511Z), spanning vercel.com docs + KB, nextjs.org, ai-sdk.dev, and other Vercel documentation sites. Full graph as JSON: https://vercel.com/docs/graph.jsonSemantically closest pagesVercel Queues — Publish agent events and background work to durable topics with independent consumers, automatic retries, and at-least-oVercel Queues: Python SDK Reference — Publish and consume messages with the Vercel Queues Python SDK.Queues concepts — Learn delivery, retries, visibility timeouts, and deployment isolation in Vercel Queues.Vercel Queues: JS SDK Reference — Publish and consume messages with the Vercel Queues SDK for JavaScript and TypeScript.Quickstart — Set up Vercel Queues with the SDK.This page links to (5)Cron Jobs — Learn about cron jobs, how they work, and how to use them on Vercel.Fluid compute — Learn about fluid compute, an execution model for Vercel Functions that provides a more flexible and efficient way to ruQueues concepts — Learn delivery, retries, visibility timeouts, and deployment isolation in Vercel Queues.Vercel Queues: Python SDK Reference — Publish and consume messages with the Vercel Queues Python SDK.Services — Deploy multiple backends and frontends within a single Vercel project using services.Pages that link here (6)By site: vercel-docs (6)Run background tasks with Celery on Vercel — Deploy Celery on Vercel. Learn how Celery workers use Vercel Queues and Vercel Functions to run background tasks withoutVercel Queues — Publish agent events and background work to durable topics with independent consumers, automatic retries, and at-least-oQueues concepts — Learn delivery, retries, visibility timeouts, and deployment isolation in Vercel Queues.Vercel Queues: Python SDK Reference — Publish and consume messages with the Vercel Queues Python SDK.Quickstart — Set up Vercel Queues with the SDK.Vercel Queues: JS SDK Reference — Publish and consume messages with the Vercel Queues SDK for JavaScript and TypeScript.