Sign in
Log inSign up
Moleculer v0.12 release notes

Moleculer v0.12 release notes

Icebob's photo
Icebob
·Mar 5, 2018

I would like to announce that the v0.12 version of Moleculer has been released. It is the biggest release in the history of the project with more than 200 commits and 17k additions. It has brought a plenty of excellent new features to the framework. In this post, I wish to share some useful information about the new version.

First of all, I would like to tell that I have created a Patreon profile. If you enjoy using Moleculer, this is your opportunity to support my work. You can read more here about supporting. Become a patron!

If you want to upgrade your project to v0.12, please read the full detailed Changelog because it contains breaking changes.

New transporters

I have implemented new transporters for Kafka and NATS Streaming. Both are a simple pub-sub implementations don’t support offsetting, replaying features, just send Moleculer packets to nodes.

New zero-configuration TCP transporter with UDP discovery

This version brings a new experimental TCP transporter. It uses UDP multicast packets to detect nodes. If your network doesn’t support UDP, you can use static node lists. Thanks to Gossip protocol, it can handle hundreds of nodes.

Please note, it is an experimental transporter, do not use it in production yet.

New default nodeID

In previous versions, the default nodeID was generated from the hostname. It confused a lot of new users when they tried to run multiple nodes on the same host because all nodes require unique nodeID. In v0.12, this logic has been changed. The default nodeID is generated from hostname and process PID.

Extended broker options

The broker options have been extended with new properties. If you use Moleculer Runner and config file, you can set your middlewares and add some lifecycle events as created, started, stopped.

CPU usage-based strategy

There is a new built-in CPU usage-based invocation strategy. It selects nodes on the basis of CPU usages.

Two-way metadata in Context

Since v0.12, the ctx.meta is sent back to the caller and is merged with the caller metadata. You can use it to send back metadata besides the response, e.g. response headers or auth data.

Better ES6 support

In this version, you can easily use ES6 classes for services. Use native ES6 classes or ES7/Typescript decorators (thanks to ColonelBundy).

Decorators

ES6 classes

Custom REPL command

You can define your custom REPL command in broker options. It can be a very useful feature during developing.

Built-in benchmark in REPL

Moleculer REPL module has a new bench command to measure your services.


Stay tuned! Follow us on Medium and Twitter, or join the Moleculer community on Gitter chat.