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

@connectum/events-redis

v1.0.0-rc.9

Published

Redis Streams adapter for @connectum/events

Readme

@connectum/events-redis

Redis Streams adapter for @connectum/events.

@connectum/events-redis connects the Connectum EventBus to Redis Streams via ioredis for lightweight, low-latency event streaming with consumer group support.

Layer: 2 (Tools) | Node.js: >=20.0.0 | License: Apache-2.0

Features

  • Redis Streams -- durable, append-only log with consumer group load balancing
  • Consumer Groups -- automatic XREADGROUP with configurable block timeout
  • Stale Message Reclamation -- XAUTOCLAIM reclaims idle pending entries
  • Stream Trimming -- optional MAXLEN trimming on publish
  • Connection Isolation -- dedicated blocking reader per subscription
  • Metadata as Fields -- event metadata stored as meta:* stream fields

Installation

pnpm add @connectum/events-redis

Peer dependencies:

pnpm add @connectum/events

Quick Start

import { createEventBus } from '@connectum/events';
import { RedisAdapter } from '@connectum/events-redis';

const bus = createEventBus({
  adapter: RedisAdapter({
    url: 'redis://localhost:6379',
  }),
  routes: [eventRoutes],
  group: 'my-service',
});

await bus.start();

With Full Options

const bus = createEventBus({
  adapter: RedisAdapter({
    url: 'redis://localhost:6379',
    redisOptions: {
      password: process.env.REDIS_PASSWORD,
      tls: {},
      db: 1,
    },
    brokerOptions: {
      maxLen: 100000,   // Trim streams to 100k entries
      blockMs: 10000,   // Block 10s per XREADGROUP call
      count: 50,        // Read 50 messages per batch
    },
  }),
  routes: [eventRoutes],
  group: 'worker-pool',
  middleware: {
    retry: { maxRetries: 3 },
    dlq: { topic: 'service.dlq' },
  },
});

API Reference

RedisAdapter()

import { RedisAdapter } from '@connectum/events-redis';

function RedisAdapter(options: RedisAdapterOptions): EventAdapter

RedisAdapterOptions

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | url | string | undefined | Redis connection URL (e.g., redis://localhost:6379) | | redisOptions | RedisOptions | undefined | ioredis connection options (merged with URL if both set) | | brokerOptions | RedisBrokerOptions | {} | Stream consumption tuning |

RedisBrokerOptions

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | maxLen | number | undefined | Max stream length (XADD MAXLEN trimming) | | blockMs | number | 5000 | XREADGROUP block timeout in ms | | count | number | 10 | Messages per XREADGROUP call |

How It Works

Stream Key Mapping

Event types are mapped to Redis stream keys with the events: prefix:

EventType: "user.created"
Stream:    "events:user.created"

Consumer Groups

Subscriptions use Redis consumer groups (XREADGROUP) for load balancing across multiple instances. Each instance creates a unique consumer name within the group.

Stale Message Reclamation

The adapter periodically calls XAUTOCLAIM (every 5 iterations) to reclaim messages that have been pending for more than 30 seconds, ensuring no messages are lost if a consumer crashes.

Connection Isolation

Each subscription creates a dedicated Redis connection for blocking XREADGROUP calls, preventing blocking operations from interfering with publish or other subscriptions.

Metadata

Event metadata is stored as stream fields with the meta: prefix:

Stream entry fields:
  payload   → serialized event data
  meta:user → "alice"
  meta:env  → "production"

Dependencies

External

  • ioredis -- Redis client for Node.js

Peer

  • @connectum/events -- EventBus core

Requirements

  • Node.js: >=20.0.0
  • Redis: >=6.2 (for XAUTOCLAIM support)

Documentation

License

Apache-2.0


Part of @connectum -- Universal framework for production-ready gRPC/ConnectRPC microservices