🔬 Writing reliable & fault-tolerant microservices in Node.js https://hemerajs.github.io/hemera/
MIT License
Bot releases are visible (Hide)
I'm really happy to announce the new Hemera 5 release!
This release is a ground-breaking refactoring of the core. The goal was to simplify but also make the lifecycle of extensions and middlwares more predictable.
Reply.end()
hemera.root
propertyHemera.reply()
in favor of hemera.reply.next()
to send multiple responses in a rowcrashOnFatal
, shouldCrash
. The developer is responsible to catch these errorsCodecPipeline
encoder
, decoder
. We provide setter functions for client and server encodinghemera.use
plugin$
, plugins property, remove hemera.setOption()
, hemera.setConfig()
methodsserverPreResponse
. This was confusing because the payload is already set at this pointhemera.ready()
not when hemera.use()
is calledadd
or middlewares
without the use of callback or promiseshemera-joi
Remove post validationhemera-nsq
and hemera-controlplane
hemera-plugin
you can skip the creation of a plugin scope with scoped:false
act(...)
won't return a promise anymore rather undefined
act(...)
will return to a fulfilled promise a context object with two properties data
and context
. On a rejection, only the error is returned.
data
message responsecontext
hemera instance with the right meta$, context$ and trace$ informations.Before
const result = await hemera.act({
topic: "math",
cmd: "add"
}, async function (err, resp) {
// code ...
})
After with promise
const result = await hemera.act({
topic: "math",
cmd: "add"
})
// code ...
result.data
result.context
After with callback
hemera.act({
topic: "math",
cmd: "add"
}, function (err, resp) {
// code ...
})
onAdd
extensions https://github.com/hemerajs/hemera/pull/188
matchedAction
which represent the matched action behind the patternexpectedMessages$
flag https://github.com/hemerajs/hemera/pull/185
sid
inside act-context publicUpgrade avvio to v5.1
hemera.on('error')
listener all errors are caught. (Default behavior of an event-emitter)hemera.on('error')
listener or catch it manually. If you use promises or async / await then it has no effect.