1.0.0 • Published 6 years ago

step-builder v1.0.0

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

N3H Step Builder

Help build flow step messager.

Conventions for Flow Step

  • each step has a name prefixed with 'flow' and flow name, such as flow.$flow.$step
  • for the entry step, subscribe the topic of its name
  • for other steps, subscribe the topics it follows
  • for all subscriptions, use its name as queue group name
  • the topics a step emits are classified into 2 categories:

    • $name.ok(.*)?
    • $name.failed(.*)?

API

buildStep

(Options) => Void

Options ~ {
  natsEx: NatsEx,
  flowName: String,
  stepName: String,
  followStep?: String,
  validator?: (data) => data,
  handler: Handler
}

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

HandlerThis ~ {
  emit: {
    ok: (data?) => messageId,
    okCase: (case: String, data?) => messageId,
    failed: (data?) => messageId,
    failedCase: (case: String, data?) => messageId,
  }
}

License

MIT