Event Receptor

Event receptor is an Observer that subscribes to events and performs operations non-related to core domain logic (i.e. send welcome email to a new user upon signup).

const { subscribe } = require('node-cqrs');

class MyReceptor {
  static get handles() {
    return [

  subscribe(observable) {
    subscribe(observable, this);

  userSignedUp({ payload }) {
    // send welcome email to payload.email

If you are creating/registering a receptor manually:

const receptor = new MyReceptor();

To register a receptor in the DI Container:


results matching ""

    No results matching ""