npm.io
1.1.0 • Published 8 years ago

n3h-action-builder

Licence
MIT
Version
1.1.0
Deps
0
Size
7 kB
Vulns
0
Weekly
0
Stars
1

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

Keywords