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

@schally/nestjs-messenger-transport-redis

v1.1.0

Published

Redis Streams transport for @schally/nestjs-messenger (not BullMQ — see ADR-003).

Downloads

448

Readme

@schally/nestjs-messenger-transport-redis

npm version License

A Redis Streams transport for @schally/nestjs-messenger. Built directly on Redis Streams (XADD / XREADGROUP / XACK / XAUTOCLAIM) via ioredisnot BullMQ (see ADR-003).

Install

# pnpm
pnpm add @schally/nestjs-messenger @schally/nestjs-messenger-transport-redis
# npm
npm install @schally/nestjs-messenger @schally/nestjs-messenger-transport-redis

Usage

Pass an instance (or factory) to MessengerModule.forRoot. The transport name must equal the routing alias it is registered under, so retries re-send to the right origin.

import { JsonSerializer, MessengerModule } from '@schally/nestjs-messenger';
import { RedisStreamsTransport } from '@schally/nestjs-messenger-transport-redis';
import { SendEmailMessage } from './messages/send-email.message';

MessengerModule.forRoot({
  transports: {
    async: () =>
      new RedisStreamsTransport({
        dsn: 'redis://localhost:6379',
        name: 'async',
        stream: 'messenger:async',
        // Register your message classes so they can be reconstructed on receive.
        serializer: new JsonSerializer([SendEmailMessage]),
      }),
    failed: () =>
      new RedisStreamsTransport({
        dsn: 'redis://localhost:6379',
        name: 'failed',
        stream: 'messenger:failed',
        serializer: new JsonSerializer([SendEmailMessage]),
      }),
  },
  routing: { [SendEmailMessage.name]: ['async'] },
  retry: { maxRetries: 3, delayMs: 1000, multiplier: 2 },
  failureTransport: 'failed',
});

DSN format

redis://[username:password@]host[:port][/db] — or rediss://… for TLS. The DSN is validated (a typo throws TransportConnectionError) and handed to ioredis for parsing.

Options (RedisStreamsTransportOptions)

| Option | Default | Description | |---|---|---| | dsn | — | Connection DSN (required). | | stream | — | Stream key messages are appended to (required). | | name | the stream | Surfaced in ReceivedStamp; must equal the routing alias for retries to find the origin. | | group | messenger | Consumer group. | | consumer | <pid>-<uuid> | Consumer name within the group. | | serializer | new JsonSerializer() | Wire serializer. Construct it with your message classes so get() can rebuild them. | | delayKey | <stream>:delayed | Sorted-set key holding not-yet-due delayed messages. | | claimIdleMs | 30000 | Idle time after which a pending message is reclaimed from a dead consumer. | | pollIntervalMs | 50 | Pause between polls when the stream is empty. | | readBatchSize | 10 | Max messages read per poll. | | redisOptions | {} | Extra ioredis options merged into the connection. |

How it works

  • Delayed delivery (DelayStamp): not-yet-due messages are held in a sorted set keyed by due-time and atomically promoted to the stream when due (a small Lua drain runs each poll).
  • Stalled-message reclaim: XAUTOCLAIM reassigns messages a dead consumer left pending (idle past claimIdleMs) to a live consumer — the own implementation of the reaper pattern (no BullMQ).
  • reject() redelivers. Per ADR-004, reject() re-appends the message with an incremented RedeliveryStamp (a fresh stream id) and XACK + XDELs the original. It is the infrastructure-error recovery path; handler-failure retry is owned by the RetryMiddleware.
  • ack() deletes. ack() is XACK + XDEL: it clears the pending entry and removes it from the stream, so the stream doesn't grow unbounded and so acking a message located via find() (failure inspection) actually deletes it.
  • Failure inspection (ListableReceiver / MessageRetriever): list(limit?) reads the stream with XRANGE (default COUNT 100) and find(id) with XRANGE id id, without consuming. These back the messenger:failed:show / :retry / :remove commands when this transport is the failureTransport. Per ADR-005, failed:retry re-enqueues the message onto its origin transport (it does not run a handler in the CLI process).
  • Poison messages (undecodable content — unregistered message type or malformed JSON) are discarded (acked) rather than looped forever via the reaper.
  • Errors are mapped to the typed hierarchy: connection failures → TransportConnectionError, missing group → TransportNotFoundError, otherwise TransportError (with the original as cause).

Testing

The transport is validated against the shared conformance suite plus targeted tests, against a real Redis (pnpm dev:brokers locally, a Redis service in CI). Mocking ioredis would test the mock, not Streams behaviour.


Made with ❤️ by schallym and contributors.