UNPKG

@logistically/events

Version:

A production-ready event-driven architecture library for NestJS with Redis Streams, comprehensive batching, reliable consumption, and enterprise-grade features.

26 lines (25 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BatchingStrategyFactory = void 0; const redis_streams_strategy_1 = require("./redis-streams-strategy"); const console_strategy_1 = require("./console-strategy"); class BatchingStrategyFactory { static createStrategy(transportType, options = {}) { const { typePrefix = 'default', batchingTypeStrategy = 'exact' } = options; switch (transportType) { case 'redis': return new redis_streams_strategy_1.RedisStreamsBatchingStrategy(typePrefix, batchingTypeStrategy); case 'console': return new console_strategy_1.ConsoleBatchingStrategy(batchingTypeStrategy); case 'kafka': // TODO: Implement Kafka strategy throw new Error('Kafka batching strategy not implemented yet'); case 'rabbitmq': // TODO: Implement RabbitMQ strategy throw new Error('RabbitMQ batching strategy not implemented yet'); default: throw new Error(`Unknown transport type: ${transportType}`); } } } exports.BatchingStrategyFactory = BatchingStrategyFactory;