Skip to main content
Queue Sandbox

Queue Sandbox

Interactive demo showcasing all the ways to use queues in RivetKit. Each tab demonstrates a different queue pattern with real-time feedback.

Features

  • Six interactive tabs demonstrating different queue patterns
  • Real-time state updates via broadcasts and polling
  • Progress indicators for long-running operations
  • Multi-queue priority handling

Implementation

This example demonstrates six queue patterns:

Send

Basic queue messaging where the client sends messages to an actor queue, and the actor manually receives them.

See src/actors/sender.ts.

Multi-Queue

Listen to multiple named queues (high, normal, low priority) simultaneously using c.queue.next(names, { count }).

See src/actors/multi-queue.ts.

Timeout

Demonstrate the timeout option when waiting for messages. Shows countdown timer and handles both successful receives and timeouts.

See src/actors/timeout.ts.

Worker

Use the run handler to continuously consume queue messages in a loop. The worker polls for jobs and processes them automatically.

See src/actors/worker.ts.

Self-Send

Actor sends messages to its own queue using the inline client pattern (c.client<typeof registry>()).

See src/actors/self-sender.ts.

Keep Awake

Consume queue messages and perform long-running tasks wrapped in c.keepAwake() to prevent the actor from sleeping during processing.

See src/actors/keep-awake.ts.

Resources

Read more about queues, run handlers, and state.