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

@anabranch/queue

v0.1.11

Published

Message queue with Task/Stream semantics. In-memory adapter with delayed messages, dead letter queues, and visibility timeout.

Readme

@anabranch/queue

Queue primitives with Task/Stream semantics for error-tolerant message processing.

Description

A queue abstraction that integrates with anabranch's Task and Stream types for composable error handling, concurrent processing, and automatic resource management.

Features

  • Task/Stream Integration: Leverage Task's retry/timeout and Stream's error collection
  • Multiple Adapters: In-memory implementation included, Redis/RabbitMQ/SQS coming soon
  • Delayed Messages: Support for scheduled/delayed message delivery
  • Dead Letter Queues: Automatic routing of failed messages after max attempts
  • Batch Operations: Send multiple messages, acknowledge multiple at once

Installation

# JSR
jsr add @anabranch/queue

# Deno
deno add @anabranch/queue

Quick Start

import { createInMemory, Queue } from "@anabranch/queue";

const connector = createInMemory();
const queue = await Queue.connect(connector).run();

// Send a message
const id = await queue
  .send("notifications", { type: "welcome", userId: 123 })
  .run();

// Process messages with error collection
const { successes, errors } = await queue
  .stream("notifications", { concurrency: 5 })
  .map(async (msg) => await sendNotification(msg.data))
  .tapErr((err) => logError(err))
  .collect()
  .then((results) => {
    const successes: typeof results = [];
    const errors: typeof results = [];
    for (const r of results) {
      if (r.type === "success") successes.push(r);
      else errors.push(r);
    }
    return { successes, errors };
  });

API

Queue.send

Send a message to a queue with optional delay:

await queue.send("my-queue", { key: "value" }, { delayMs: 30_000 }).run();

Queue.stream

Stream messages with concurrent processing:

const { successes, errors } = await queue
  .stream("orders", { count: 10, concurrency: 10 })
  .map(async (msg) => await processOrder(msg.data))
  .partition();

Queue.ack / Queue.nack

Acknowledge successful processing or negative acknowledge with requeue:

await queue.nack("orders", msg.id, { requeue: true, delay: 5_000 }).run();

// Or route to dead letter queue
await queue.nack("orders", msg.id, { deadLetter: true }).run();

Queue.sendBatch

Send multiple messages efficiently:

const ids = await queue
  .sendBatch("notifications", [
    { to: "[email protected]" },
    { to: "[email protected]" },
  ])
  .run();

Configuration

In-Memory Queue Options

const connector = createInMemory({
  maxBufferSize: 1000,
  queues: {
    orders: {
      maxAttempts: 3,
      deadLetterQueue: "orders-failed",
    },
  },
});

Error Handling

All errors are typed for catchable handling:

  • QueueConnectionFailed - Connection establishment failed
  • QueueSendFailed - Send operation failed
  • QueueReceiveFailed - Receive operation failed
  • QueueAckFailed - Acknowledgment failed
try {
  await queue.send("my-queue", data).run();
} catch (error) {
  if (error instanceof QueueSendFailed) {
    console.error("Failed to send:", error.message);
  }
}

Related