npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@objectstack/service-queue

v9.11.0

Published

Queue Service for ObjectStack — implements IQueueService with in-memory and durable DB-backed (sys_job_queue) adapters

Readme

@objectstack/service-queue

Queue Service for ObjectStack — implements IQueueService with an in-memory adapter and a durable, database-backed adapter (sys_job_queue).

Adapters

| Adapter | Durable | Multi-node | Use | | --- | --- | --- | --- | | memory | No (in-process) | No | dev / test / ephemeral work | | db | Yes (sys_job_queue) | Yes (lease-based claim) | production default | | auto (default) | — | — | db when an ObjectQL engine is present, else memory |

The db adapter persists messages, retries, and the dead-letter queue to the sys_job_queue object. Multiple worker processes claim messages from the shared table with a lease (leaseMs), so it works across a multi-node deployment without any external broker — no Redis required. Studio can list and replay the DLQ because sys_job_queue is a first-class object.

A BullMQ/Redis adapter is not shipped. The durable path is the DB adapter; it rides on the same datasource the runtime already uses. If you genuinely need a Redis-backed broker, register a custom IQueueService via ctx.registerService('queue', myAdapter).

Installation

pnpm add @objectstack/service-queue

Usage

import { ObjectKernel } from '@objectstack/core';
import { QueueServicePlugin } from '@objectstack/service-queue';

const kernel = new ObjectKernel();
// 'auto' (default): durable DbQueueAdapter when ObjectQL is available, else memory
kernel.use(new QueueServicePlugin({ adapter: 'auto' }));
await kernel.bootstrap();

const queue = kernel.getService('queue'); // IQueueService

// Publish a message
await queue.subscribe('email', async (msg) => {
  await sendEmail(msg.data);
});

await queue.publish('email', { to: '[email protected]', template: 'welcome' }, {
  // delay / priority / retries (see QueuePublishOptions)
  attempts: 3,
});

Configuration

// Force the durable DB adapter (requires an ObjectQL engine)
new QueueServicePlugin({
  adapter: 'db',
  db: {
    pollIntervalMs: 1000,   // worker poll cadence
    batchSize: 10,          // messages claimed per tick
    leaseMs: 30000,         // lease before another worker may reclaim
    idempotencyWindowMs: 24 * 60 * 60 * 1000,
  },
});

// In-process only (non-durable) — dev / test
new QueueServicePlugin({ adapter: 'memory' });

Service API

Implements IQueueService from @objectstack/spec/contracts:

interface IQueueService {
  publish<T>(queue: string, data: T, options?: QueuePublishOptions): Promise<string>;
  subscribe<T>(queue: string, handler: QueueHandler<T>): Promise<void>;
  unsubscribe(queue: string): Promise<void>;
  getQueueSize?(queue: string): Promise<number>;
  purge?(queue: string): Promise<void>;
  // Dead-letter queue (db adapter)
  listFailed?(queue?: string, options?: { limit?: number; offset?: number }): Promise<QueueMessageRecord[]>;
  replay?(messageId: string): Promise<void>;
  purgeFailed?(messageId: string): Promise<void>;
}

Best Practices

  1. Idempotent handlers — messages may be re-delivered after a lease expires.
  2. Small payloads — keep message data compact for fast serialization.
  3. Handle the DLQ — monitor listFailed() and replay() poisoned messages.
  4. Use db in productionmemory loses in-flight work on restart and does not coordinate across nodes.

License

Apache-2.0. See LICENSING.md.

See Also