NestJS CQRS NATS Jetstream
NestJS CQRS module for NATS JetStream. It requires @nestjs/cqrs.
Installation
$ yarn install nestjs-cqrs-nats-jetstream
Description
This module enable NestJS CQRS to work with NATS JetStream.
Setup root app module
;;
Setup
Setup NATS JetStream
Create a stream by configuring the subject with a wildcard. Your events will be published with the featureSubjectPrefix
, something like USER.UserLoggedInEvent
. Thus, all events published by the module will be sent to that stream.
$ nats stream add? Stream Name USER? Subjects to consume USER.*? ...
You now need to create one or more consumers. The module can subscribe to one or more, do as you see fit. The name of the consumer makes no difference to the handlers, we only need the delivery target to subscribe.
$ nats consumer add? Consumer name USER-SERVICE? Delivery target CONSUMER-user-service? ...
Setup feature module
;;;;
License
This project is MIT licensed.