moleculer
Advanced tools
Changelog
0.8.2 (2017-07-06)
fixed Redis cacher option resolver in ServiceBroker. Now it accepts connection string.
const broker = new ServiceBroker({
cacher: "redis://localhost"
});
The fastest-validator is updated to v0.5.0. It supports multi rules & custom validators.
<a name="0.8.1"></a>
Changelog
0.8.0 (2017-06-21)
There is a new Moleculer project runner script in the bin
folder.
You can use it if you want to create small repos for services. In this case you needn't to create a ServiceBroker with options. Just create a moleculer.config.js
or moleculer.config.json
file in the root of repo fill it with your options and call the moleculer-runner
within the NPM scripts.
As an other solution you can put it to the environment variables instead of putting options to file.
Some new resolvers are implemented in broker options to support shorthand configurations. This feature is enabled to load broker options easily from a JSON file or load from environment variables.
Usage for transporters
// Connect to the NATS default (localhost) server
const broker = new ServiceBroker({
transporter: "NATS"
});
// Connect to a NATS server with connection string
const broker = new ServiceBroker({
transporter: "nats://nats-server:4222"
});
// Connect to a NATS server with transporter options
const broker = new ServiceBroker({
transporter: {
type: "NATS",
options: {
prefix: "TEST",
nats: {
host: "nats-server",
user: "admin",
pass: "nats-pass"
}
}
}
});
Usage for cachers
// Use a memory cacher
const broker = new ServiceBroker({
cacher: true
// or
// cacher: "Memory"
});
// Use a Redis cacher with default options
const broker = new ServiceBroker({
cacher: "Redis"
});
// Use a Redis cacher with options
const broker = new ServiceBroker({
cacher: {
type: "Redis",
options: {
ttl: 100
}
}
});
Usage for serializers
// Use the Avro serializer
const broker = new ServiceBroker({
serializers: "Avro"
});
// Use the Protocol Buffer serializer
const broker = new ServiceBroker({
serializers: {
type: "ProtoBuf"
}
});