1.1.0 • Published 6 years ago

n3h-action-builder v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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