npm.io
1.5.0 • Published 5d ago

@nestjs-redisx/streams

Licence
MIT
Version
1.5.0
Deps
0
Size
225 kB
Vulns
0
Weekly
0
Stars
40

NestJS RedisX

@nestjs-redisx/streams

npm npm downloads license

Redis Streams plugin for NestJS RedisX. Provides StreamProducerService for publishing and @StreamConsumer decorator for declarative consumer groups with dead-letter queues and backpressure.

Installation

npm install @nestjs-redisx/core @nestjs-redisx/streams ioredis

Quick Example

import { RedisModule } from '@nestjs-redisx/core';
import { StreamsPlugin, StreamConsumer, STREAM_PRODUCER, IStreamProducer } from '@nestjs-redisx/streams';

@Module({
  imports: [
    RedisModule.forRoot({
      clients: { host: 'localhost', port: 6379 },
      plugins: [new StreamsPlugin({ consumer: { batchSize: 10 }, dlq: { enabled: true } })],
    }),
  ],
})
export class AppModule {}

@Injectable()
export class OrderService {
  constructor(@Inject(STREAM_PRODUCER) private producer: IStreamProducer) {}
  async create(order: Order) {
    await this.producer.publish('orders', { orderId: order.id });
  }
}

@Injectable()
export class OrderProcessor {
  @StreamConsumer({ stream: 'orders', group: 'processors' })
  async handle(msg: { orderId: string }) { /* process */ }
}

Documentation

Full documentation: nestjs-redisx.dev/en/reference/streams/

Using with AI Assistants

For better code generation with AI tools (Cursor, Claude Code, GitHub Copilot, etc.), point your agent to the full API reference:

https://nestjs-redisx.dev/llms-full.txt

License

MIT