Giter Club home page Giter Club logo

erlang-nkserver's Introduction

NkSERVER

Introduction

NkSERVER is an Erlang framework to develop microservices based on powerful plugin mechanism. A growing number of Packages following this pattern are available, like Rest servers, Kafka producers and consumers, database connectors, etc. NkSIP is also based on NKSERVER.

Characteristics

  • Any Erlang application can start any number of services, inserting them in its OTP application supervisor.
  • A powerful plugin mechanism, so that any package is made of a set of plugins and some custom login.
  • Configuration for services can be changed at any moment.
  • Designed from scratch to be highly scalable, having a very low latency.
  • Rich set of Packages already available to build servers.

Packages and plugins

NkSERVER features a sophisticated package system, based on plugins that allows a developer to modify the behavior of packages without having to modify its core, while having nearly zero overhead. Each plugin adds new APIs and callbacks or hooks, available to the service developer or other, higher level plugins.

Each server using NKSERVICE defines a callback module and a base package, and optionally, a set of plugins.

Plugins have the concept hierarchy and dependency. For example, if pluginA implements callback callback1, we can define a new plugin pluginB which depends on pluginA and also implements callback1. Now, if the service (or other higher level plugin) happens to use this callback1, when it is called by NkSERVER, the one that will be called first will ve the pluginB version, and only if it returns continue or {continue, Updated} the version of pluginA would be called.

Any plugin can have any number of dependent plugins. NkSERVER will ensure that versions of plugin callbacks on higher order plugins are called first, calling the next only in case it passes the call to the next plugin, possibly modifying the request. Eventually, the call will reach the default NkSERVER's implementation of the callback (defined in nkserver_callbacks.erl if all defined callbacks decide to continue, or no plugin has implemented this callback).

Plugin callbacks must be implemented in a module with the same name as the plugin plus _"callbacks" (for example my_plugin_callbacks.erl). Plugin definitions must be implemented in a module with the same name of the plugin, plus _"plugin"

This callback chain behavior is implemented in Erlang and compiled on the fly, into a run-time generated service callback module. This way, any call to any plugin callback function is really fast, very similar as if it were hard-coded from the beginning. Calls to plugin callbacks not implemented in any plugin go directly to the default NkSERVER implementation.

Each server can have different set of plugins, and it can it be changed in real time as any other server configuration value.

erlang-nkserver's People

Contributors

kalta avatar jamesaimonetti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.