# nest-external-eventbus

> external eventbus module for @nestjs/cqrs

Latest version **0.0.5** (published 2022-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install nest-external-eventbus
pnpm add nest-external-eventbus
yarn add nest-external-eventbus
bun add nest-external-eventbus
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2022-07-22 |
| First published | 2022-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 14 |
| Dependencies | 4 |
| Unpacked size | 20.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | goznauk |
| Maintainers | goznauk~ |
| Keywords | eventbus, microservice, cqrs, nestjs, redis |

## Links

- npm: https://www.npmjs.com/package/nest-external-eventbus
- Repository: https://github.com/goznauk/nest-external-eventbus
- Homepage: https://github.com/goznauk/nest-external-eventbus#readme
- Issues: https://github.com/goznauk/nest-external-eventbus/issues
- npm.io page: https://npm.io/package/nest-external-eventbus

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^7
- [redis](https://npm.io/package/redis.md) ^4.2.0
- [ioredis](https://npm.io/package/ioredis.md) ^5.2.1
- [@liaoliaots/nestjs-redis](https://npm.io/package/@liaoliaots/nestjs-redis.md) ^9

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2022-07-22
- 0.0.4 — 2022-07-22
- 0.0.3 — 2022-07-22
- 0.0.2 — 2022-07-21
- 0.0.1 — 2022-07-21

## README

<p align="center">
  <a href="http://nestjs.com/" target="blank">
    <img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" />
  </a>
</p>

<p align="center">
  A Cqrs External EventBus module for Nest framework (node.js)
</p>
<p align="center">
  Now available: Redis-EventBus
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/nest-external-eventbus"><img src="https://img.shields.io/npm/v/nest-external-eventbus.svg" alt="NPM Version" /></a>
  <a href="https://www.npmjs.com/package/nest-external-eventbus"><img src="https://img.shields.io/npm/l/nest-external-eventbus.svg" alt="Package License" /></a>
  <a href="https://www.npmjs.com/package/nest-external-eventbus"><img src="https://img.shields.io/npm/dm/nest-external-eventbus.svg" alt="NPM Downloads" /></a>
</p>

### Installation

#### with npm

```sh
npm install --save nest-external-eventbus
```

#### with yarn

```sh
yarn add nest-external-eventbus
```

### How to use?

#### RedisBusModule.forRoot(events, redisOption)

```ts
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 {}
```

#### Event Should extend StandardEvent

```ts
import { StandardEvent } from 'nest-external-eventbus';

export class HeroKilledDragonEvent extends StandardEvent {
	public constructor(public readonly payload: object) {
		super();
	}
}
```

### Example

```sh
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
```

## License

MIT

---
_Source: https://npm.io/package/nest-external-eventbus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
