Use native queue handles
Know when to use getQueue and provider-native methods instead of the portable runtime API.
The portable Queue API is defineQueue(), runQueue(), deferQueue(), and getQueue(). Stay there when you can.
Use native queue handles only when the provider exposes something important that the portable API cannot represent.
Start with getQueue()
import { getQueue } from '@vitehub/queue'
const queue = await getQueue('welcome-email')
console.log(queue.provider)
getQueue() resolves the active provider handle for the named queue. From there, provider-specific methods become available.
Good reasons to use native methods
Reach for provider-native APIs when you need:
- Cloudflare batch handlers
- Vercel callback or polling helpers
- Netlify Async Workloads handlers
- Platformatic worker lifecycle control
- Upstash QStash publish, schedules, or callback verification flows
- Memory inspection and manual draining during development
Keep the boundary narrow
A good pattern is:
- keep queue discovery and enqueue calls portable
- isolate provider-native code to one module or route
- document why the provider-specific method is required
That keeps most of your app portable even if one integration point is not.