examples/queue-sandbox-vercel/README.md
Note: This is the Vercel-optimized version of the queue-sandbox example. It uses the
hono/verceladapter and is configured for Vercel deployment.
Interactive demo showcasing all the ways to use queues in RivetKit. Each tab demonstrates a different queue pattern with real-time feedback.
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/queue-sandbox
npm install
npm run dev
This example demonstrates six queue patterns:
Basic queue messaging where the client sends messages to an actor queue, and the actor manually receives them.
See src/actors/sender.ts.
Listen to multiple named queues (high, normal, low priority) simultaneously using for await (const m of c.queue.iter({ names: [...] })).
See src/actors/multi-queue.ts.
Demonstrate the timeout option when waiting for messages. Shows countdown timer and handles both successful receives and timeouts.
Use the run handler to continuously consume queue messages in a for await loop.
See src/actors/worker.ts.
Actor sends messages to its own queue using the inline client pattern (c.client<typeof registry>()).
See src/actors/self-sender.ts.
Consume queue messages and perform long-running tasks wrapped in c.keepAwake() to prevent the actor from sleeping during processing.
Read more about queues, run handlers, and state.
MIT