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

v1.1.0

Published

A unified message bus for NestJS with pluggable transports, modelled on Symfony Messenger.

Downloads

897

Readme

@schally/nestjs-messenger

npm version License

Symfony Messenger's developer experience, native to NestJS. A unified message bus with a middleware pipeline, an envelope/stamps system, pluggable transports, retry with backoff, a failure transport, and a worker CLI.

# pnpm
pnpm add @schally/nestjs-messenger
pnpm add @schally/nestjs-messenger-transport-redis # plus a transport (the reference one)

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

Full quickstart, custom-middleware guide, and the BullMQ migration guide live in the repository README.

60-second tour

import { Injectable, Module } from '@nestjs/common';
import {
  MessageBus,
  MessageHandler,
  MessengerModule,
  InMemoryTransport,
} from '@schally/nestjs-messenger';

export class SendWelcomeEmailMessage {
  constructor(public readonly email: string) {}
}

@Injectable()
@MessageHandler(SendWelcomeEmailMessage)
export class SendWelcomeEmailHandler {
  async handle(message: SendWelcomeEmailMessage): Promise<void> {
    // ...do the work; throw to trigger retry, then the failure transport...
  }
}

@Module({
  imports: [
    MessengerModule.forRoot({
      transports: { async: () => new InMemoryTransport({ name: 'async' }) },
      routing: { [SendWelcomeEmailMessage.name]: ['async'] },
      retry: { maxRetries: 3, delayMs: 1000, multiplier: 2 },
    }),
  ],
  providers: [SendWelcomeEmailHandler],
})
export class AppModule {}

// Dispatch from anywhere: constructor(private readonly bus: MessageBus) {}
//   await this.bus.dispatch(new SendWelcomeEmailMessage('[email protected]'));

A message routed to no transport is handled synchronously inside dispatch(); routed messages wait on the transport until a worker consumes them.

Peer dependencies

Provide these in your app (NestJS 10+):

  • @nestjs/common, @nestjs/core, reflect-metadata — required.
  • nest-commander — required only if you use the CLI subpath (worker / failure commands).
  • jest — required only if you use the conformance suite from the testing subpath.

Subpath exports

| Import | Contents | |---|---| | @schally/nestjs-messenger | Envelope, stamps, MessageBus, middleware, TransportInterface + InMemoryTransport, retry, serializer, typed errors, MessengerModule, @MessageHandler, Worker. | | @schally/nestjs-messenger/cli | ConsumeCommand, FailedShowCommand, FailedRetryCommand, FailedRemoveCommand (nest-commander). | | @schally/nestjs-messenger/testing | runTransportConformanceTests, ConformanceMessage — validate any transport against the shared contract. |

CLI

Register the commands as providers in a nest-commander CommandFactory module, then:

node dist/cli messenger:consume <transport> --limit=100 --time-limit=3600 --memory-limit=128M
node dist/cli messenger:failed:show [id]
node dist/cli messenger:failed:retry <id...>
node dist/cli messenger:failed:remove [id...] --all

Concept vocabulary

Message (a plain class) → wrapped in an Envelope carrying Stamps (typed metadata) → routed by the MessageBus through a Middleware pipeline → to a Transport (Sender/Receiver) → consumed by a Worker → handled by a Handler. Failures retry per the configured strategy, then route to the failure transport. Bus (MessageBus) and Worker are the main entry points.

Writing a transport

Implement TransportInterface and validate it against the conformance suite:

import { runTransportConformanceTests } from '@schally/nestjs-messenger/testing';

runTransportConformanceTests({
  name: 'MyTransport',
  createTransport: async () => ({ transport: new MyTransport(), cleanup: () => /* ... */ }),
  capabilities: { delayedDelivery: true, listable: true },
});

See the transport-implementation skill.

License

MIT.


Made with ❤️ by schallym and contributors.