A Cqrs External EventBus module for Nest framework (node.js)
Now available: Redis-EventBus
npm install --save nest-external-eventbus
yarn add nest-external-eventbus
import { Module, Type } from '@nestjs/common';
import { HeroKilledDragonEvent, HeroFoundItemEvent } from './events'
import { RedisBusModule, RedisBusOptions } from 'nest-external-eventbus';
const events: Type[] = [HeroKilledDragonEvent, HeroFoundItemEvent];
const redisOption: RedisBusOptions = {
subUrl: 'redis://localhost:6379',
subChannel: 'REDIS_CHANNEL_HERE',
};
@Module({
imports: [
RedisBusModule.forRoot(events, redisOption),
],
controllers: [],
})
export class AppModule {}
import { StandardEvent } from 'nest-external-eventbus';
export class HeroKilledDragonEvent extends StandardEvent {
public constructor(public readonly payload: object) {
super();
}
}
git clone git@github.com:goznauk/nest-external-eventbus.git
cd nest-external-eventbus
npm install
docker run -d -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
cd examples/simpleCqrs/
npm run start
pip3 install redis asyncio
python3 test.py
MIT