New
Service dependencies #102
The Service
schema has a new dependencies
property. The serice can wait for other dependening ones when it starts. This way you don't need to call waitForServices
in started
any longer.
module.exports = {
name: "posts",
settings: {
$dependencyTimeout: 30000 // Default: 0 - no timeout
},
dependencies: [
"likes", // shorthand w/o version
{ name: "users", version: 2 }, // with numeric version
{ name: "comments", version: "staging" } // with string version
],
started() {
this.logger.info("Service started after the dependent services available.");
}
....
}
The started
service handler is called once the likes
, users
and comments
services are registered (on the local or remote nodes).
Pending request queue size limit #111
The ServiceBroker
has a new maxQueueSize
option under transit
key. The broker protects the process to avoid crash during a high load with it. The maxQueueSize
default value is 50,000. If pending request queue size reaches it, broker rejects the request with a QueueIsFull
(retryable) error.
let broker = new ServiceBroker({
transporter: "NATS",
transit: {
maxQueueSize: 10 * 1000
}
}
Changes
The waitForServices
method supports service versions #112
By @imatefx, the waitForServices
broker & service methods support service versions. Use the following formats to define version in a dependency:
module.exports = {
name: "test",
dependencies: { name: "users", version: 2 }
};