n3h-action-builder

1.1.0 • Public • Published

N3H Action Builder

Help build action messager.

Conventions for Action

  • each action has such a full name: action.$serviceName.$actionName
  • the topic of its full name trigger the action
  • each action uses its full name as queue group name
  • action could return any result
  • action could emit side effect messages with the topic pattern $fullName.$case

API

buildAction

(Options) => Void

Options ~ {
  natsEx: NatsEx,
  serviceName?: String,
  actionName: String,
  validator?: (data) => data,
  handler: Handler
}

Handler ~ (data, message, receivedTopic): HandlerThis => Promise => Any

HandlerThis ~ {
  emit: (case, data?) => messageId
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i n3h-action-builder

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

7.04 kB

Total Files

4

Last publish

Collaborators

  • zhaoyao91