Node.js version of the muon reactive api toolkit.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
doc
examples
integration_tests
muon
test
.babelrc
.editorconfig
.gitignore
.npmignore
CHANGELOG.md
COMM-LICENSE
Dockerfile
LICENSE
Makefile
README.adoc
code_of_conduct.md
docker-compose.yml
package.json

README.adoc

Master Build

NPM Stable

Snapshots

Status

NPM

NPM

Muon Core - Node.js

This repo contains the Nodejs implementation of Muon Core.

What is Muon?

Microservices today are optimised for building systems that can continue to change as you need them to. The achieve this, you decompose an application into its component parts, then recompose it back together again using some form of integration technology. The most common form of integration today is RPC based, whether HTTP, gRPC or one of its friends.

RPC is a fairly simplistic model for integration, with well known flaws and foibles. The other options, messaging and event collaboration are much harder to get started with, and so are often avoided until the "v2 rewrite". Muon lets you adopt messaging and events from the start of a project, by making it easy to do the right thing with them.

Muon is fully polyglot, give you very well defined, easy to use apis that take advantage of messaging, and eventing, to recompose your distributed system in highly performant, rich communication styles, beyond RPC.

What is Muon Core?

Muon is a modular system, allowing it to be easily extended to take advantage of the best of breed technologies and leverage what you may call "legacy", giving it a new lease of life and protecting your investment.

Muon Core is the library that defines the central programming model of the system. It creates channel based communicaiton between microservices, enabling message based communication to happen. Each runtime we support has its own implementation of Muon Core. This repository is for Node.js.

It can be extended by adding one of more of:-

  • Protocol Stacks - The most important extension. This defines a messaging interaction between systems, and gives it an easy to use, language idiomatic API for you to use.

  • Transports - Take advantage of different integration technologies, service meshes, brokers. These are all enabled by a network transport.

  • Discovery - Enable a Muon system to integrate with your existing infrastructure and locate other systems across your deployment.

  • Codec - Convert objects for transport and enable defining of Schemas for client side validation. Not often extended, but available. We currently support JSON and Avro.

Using Muon Node

To use Muon, you need to use Muon Core, a transport, a discovery and one or more protocol stacks.

Install Muon, a transport, discovery and simple protocol stack (RPC) into an Npm project like so

npm install --save muon-core@next
npm install --save muon-amqp@next
npm install --save muon-stack-rpc@next

You can then create a new instance of Muon with the Discovery and Transport activated. This will appear on the network.

Setting this up is somewhat specific to the transport and discovery in question. Assuming AMQP (as above), the creation looks similar to.

var Muon = require("muon-core")

require("muon-amqp").attach(Muon)

var muon = Muon.create("amqp://localhost")

require("muon-stack-rpc").create(muon)

muon.handle('/', (request, respond) => {
    respond({
        message: "Hi there!"
    })
})

Run this, and it will appear on the network with an RPC endpoint available for you to interact with. Read more at the RPC stack to see what you can do.

You can also see more stacks that you can include that give very different models of interaction.

Find out more about about the AMQP support

Contributing to Muon Core

Contributions to Muon are very welcome.

You can contribute by filing bugs on any of the repositories, pull requests for existing issues are also welcome (please note the licensing/ copyright assignment requirements)

Apart from the existing repositories, the most useful areas to extend Muon are :-

  • Add a new stack. Got an idea or requirement for how systems should communicate? In Muon, this is expressed as a stack, with an idiomatic API. Write your own and contribute it to the community!

  • Add a transport. Is your broker not supported? Do you want to go brokerless, use direct TCP? Are you rolling out a service mesh? This is a transport.

  • Add a discovery. Etcd, Eureka, DNS. These are discovery systems, and Muon can be updated to work with any of them, and in fact, all of them at once. Write a Discovery to take advantage of them.

See [documentation](http://muoncore.io)

License

All code is Copyright (c) Muon Core Ltd 2017.

Muon is Free Software, licensed under the terms of the LGPLv3 license as included in LICENSE

Muon has a commercial-friendly license allowing private forks and closed modifications of all projects, alongside enterprise support and extended support for enterprise technologies and patterns.

This will enable you to use Muon in any situation where your legal team will not accept a Free Software license.

Please see http://muoncore.io/pro/ for more detail. You can find the commercial license terms in COMM-LICENSE.