New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@addapptables/manager-bus

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@addapptables/manager-bus

- manager-bus is a library for nodejs oriented to microservices, this library is made to work with [nestjs](https://docs.nestjs.com/)

latest
npmnpm
Version
2.0.0
Version published
Maintainers
3
Created
Source

manager-bus

  • manager-bus is a library for nodejs oriented to microservices, this library is made to work with nestjs

  • Example code

Getting Started

To get started, let's install the package through npm:

npm i @addapptables/manager-bus --S

Install peerDependencies

npm i @addapptables/bus @addapptables/cqrs @nestjs/common @nestjs/core --S

How to use

  • Import the module
import { ManagerBusModule, BusType } from '@addapptables/manager-bus';
@Module({
    imports: [
        ManagerBusModule.forRoot({
            busType: BusType.RMQ,
            options: {
                exchange: 'exchange',
                service: 'domain-service',
                host: process.env.BUS_URL,
            },
        })
    ],
})
export class YourModule { }
  • Create command handlers
import { ICommandHandler, CommandHandler, ICommand } from '@addapptables/cqrs';

@CommandHandler({ context: 'context', action: 'action' })
export class CommandHandler implements ICommandHandler<YourCommandClass> {

    handle = async (command: ICommand<YourCommandClass>): Promise<void> => {
        // Save in event store
    }

}
  • Create event handlers
import { IEventHandler, IEvent, EventHandler } from '@addapptables/cqrs';

@EventHandler({ context: 'context', action: 'action' })
export class ActionHandler implements IEventHandler<YourActionEvent> {

    handle = async ({ data }: IEvent<YourActionEvent>): Promise<void> => {
        try {
            console.log(data);
        } catch (error) {
            console.log('error', error);
        }
    }

}

Keywords

event sourcing

FAQs

Package last updated on 05 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts