@logistically/events
Version:
A production-ready event-driven architecture library for NestJS with Redis Streams, comprehensive batching, reliable consumption, and enterprise-grade features.
32 lines (31 loc) • 867 B
TypeScript
import { EventHandler } from './consumer';
import { Redis } from 'ioredis';
import { EventValidator } from '../event-types';
export interface RedisStreamConsumerOptions {
redis: Redis;
stream: string;
group: string;
consumer: string;
handlers: Record<string, EventHandler>;
onError?: (err: Error, eventType: string, envelope: any) => void;
blockMs?: number;
count?: number;
deadLetterStream?: string;
verbose?: boolean;
validator?: EventValidator;
}
export declare class RedisStreamConsumer {
private eventConsumer;
private redis;
private stream;
private group;
private consumer;
private blockMs;
private count;
private deadLetterStream?;
private running;
private verbose;
constructor(options: RedisStreamConsumerOptions);
pollAndHandle(): Promise<void>;
stop(): void;
}