Skip to content

v0.7.0

Compare
Choose a tag to compare
@icebob icebob released this 12 Feb 08:45
· 57 commits to master since this release

Moleculer updated to latest 0.14

With this version, you can connect to only v0.14 Moleculer nodes.

New call command

There is a call command to connect a Moleculer project & call an action with parameters. The result (stringified JSON) will be printed to the console what you can process with another tool.

The calling parameters should be started with @ prefix. The meta parameters should be started with # prefix.

Example with params

moleculer call math.add --transporter NATS --@a 5 --@b 3

Example with params & meta

moleculer call math.add --transporter NATS --@a 5 --@b 3 --#meta-key MyMetaValue

Example with post processing the result with jq

moleculer call "\$node.health" | jq '.mem.free'

The transporter can be defined via TRANSPORTER environment variable, as well.

Example with transporter env var

TRANSPORTER=nats://localhost:42222 moleculer call math.add --@a 5 --@b 3

New emit command

There is a emit command to connect a Moleculer project & emit an event with payload.
The calling parameters should be started with @ prefix. The meta parameters should be started with # prefix.

Example with params

moleculer emit user.created --transporter NATS --@id 3 --@name John

Example with params & meta

moleculer emit math.add --transporter NATS --@id 3 --@name John --#meta-key MyMetaValue

Example with broadcast & groups

moleculer emit math.add --transporter NATS --broadcast --@id 3 --@name John --group accounts

Example with multi groups

moleculer emit math.add --transporter NATS --broadcast --@id 3 --@name John --group accounts --group mail

The transporter can be defined via TRANSPORTER environment variable, as well.

Example with transporter env var

TRANSPORTER=nats://localhost:42222 moleculer call math.add --@a 5 --@b 3

Changes

  • update dependencies
  • remove --cb, --metrics options
  • init command: add --answers <answer-json-filename> to load answer from file instead of stdin.
  • init command: add --install & --no-install option to enable/disable npm install after the files generated.
  • level parameter for the start, connect, call, emit command to set the logging level.