hemera

🔬 Writing reliable & fault-tolerant microservices in Node.js https://hemerajs.github.io/hemera/

MIT License

Downloads
77.3K
Stars
805
Committers
20

Bot releases are visible (Hide)

hemera -

Published by StarpTech over 6 years ago

Removed dependencies lodash, hoek and fastparellel and use built-in functions.

hemera -

Published by StarpTech over 6 years ago

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.

In summary:

Breaking changes:

  • Removed Reply.end()
  • Removed hemera.root property
  • Removed Hemera.reply() in favor of hemera.reply.next() to send multiple responses in a row
  • Removed configuration properties crashOnFatal, shouldCrash. The developer is responsible to catch these errors
  • Removed CodecPipeline
  • Removed encoder, decoder. We provide setter functions for client and server encoding
  • Remove support to register multiple plugins at once with hemera.use
  • Remove plugin$, plugins property, remove hemera.setOption(), hemera.setConfig() methods
  • Remove functionality to to send a response inside serverPreResponse. This was confusing because the payload is already set at this point
  • Load plugins only on hemera.ready() not when hemera.use() is called
  • We break the support of simple return values in add or middlewares without the use of callback or promises

New features:

  • Implement schemaCompiler to archive better abstraction for payload validators
  • Support for async schemaCompiler
  • Encapsulate extensions, codec and schemaCompiler
  • Provide setter functions for client and server encoding

Modified packages

  • hemera-joi Remove post validation
  • Remove support for hemera-nsq and hemera-controlplane
  • hemera-plugin you can skip the creation of a plugin scope with scoped:false

Bug fixes

  • Fixed issue in add middleware. Passed errors didn't lead to cancellation
hemera -

Published by StarpTech over 6 years ago

Breaking changes

  • Use of callback-style with act(...) won't return a promise anymore rather undefined
  • Use of promise-style with 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 response
    • context hemera instance with the right meta$, context$ and trace$ informations.

Migration Guide

Don't mix callback and promise style and work in case of promise with the result object

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 ...
})
hemera -

Published by StarpTech over 6 years ago

  • Support of custom parent span via context$
  • Remove hemera version from span tags
  • Use pattern as span operation name
  • Add HEMERA_OP_TYPE, HEMERA_ACT_EXPECTEDMSG and HEMERA_CONTEXT tags
hemera -

Published by StarpTech over 6 years ago

  • Refactor tracing
  • Fixed tracing propagation
hemera -

Published by StarpTech over 6 years ago

hemera -

Published by StarpTech over 6 years ago

  • Add promise support for close method
  • Stop emitting close errors rather pass them via callback or promise style
hemera -

Published by StarpTech over 6 years ago

hemera -

Published by StarpTech over 6 years ago

Add promise support for hemera.ready() when no callback is passed.

hemera -

Published by StarpTech over 6 years ago

  • Upgrade nats-hemera dependencies
  • Upgrade dev-dependencies from Repository
hemera -

Published by StarpTech over 6 years ago

Upgrade avvio to v5.1

hemera -

Published by StarpTech almost 7 years ago

Throw error when hemera was already boostraped

hemera -

Published by StarpTech almost 7 years ago

  • Allow hemera to be ready even when the nats connection was already established
hemera -

Published by StarpTech almost 7 years ago

  • Introduce hemera.reply([Error, any]) to reply multiple message. Don't call cb multiple times.
hemera -

Published by StarpTech almost 7 years ago

  • Don't close hemera when an error listener was registered
hemera -

Published by StarpTech almost 7 years ago

Execute onClose hook and gracefully shutdown hemera on synchronous uncaught error

hemera -

Published by StarpTech almost 7 years ago

Improvements

  • Don't swallow synchronous uncaught errors, let them handle by the user. This is needed to identify the real error during testing. If you add an hemera.on('error') listener all errors are caught. (Default behavior of an event-emitter)
  • Gracefully shutdown nats and process when calling fatal()

Breaking Changes

  • Any synchronous uncaught error will exit the process except you define an hemera.on('error') listener or catch it manually. If you use promises or async / await then it has no effect.
hemera -

Published by StarpTech almost 7 years ago

  • Use same way in all cases to handle the end of a request lifecycle.
  • Update doc
hemera -

Published by StarpTech almost 7 years ago

  • Support async, promise and raw values in middlewares
  • Clean up code, remove unused functions and tests
  • Avoid calling action when calling reply.end(<msg>) in middlewares
hemera -

Published by StarpTech almost 7 years ago

  • add When no callback is provided any returned value is accepted as a result.
Package Rankings
Top 2.0% on Npmjs.org
Badges
Extracted from project README
appcom-interactive amerbank savicontrols mercado unico