Skip to content

NetComposer/nkactor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NkACTOR

Introduction

NkACTOR is an Erlang distributed application server, along with a scripting engine (based on Luerl) and a growing number of Packages ready to use like RestServers, Kafka producers and consumers, Token management, etc.

Characteristics

  • A powerful plugin mechanism, so that any package is made of a set of plugins and a bit of custom login.
  • New packages and modules can be added or removed at any moment. Its configuration can be changed at any moment.
  • A powerful events mechanism with publish/subscribe semantics.
  • A way to define service configuration and to develop server-side code using Luerl, a Lua-like language that is translated to Erlang on the fly.
  • Designed from scratch to be highly scalable, having a very low latency.

Packages and plugins

NkACTOR 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.

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 NkACTOR, 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. NkACTOR 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 NkACTOR's implementation of the callback (defined in nkactor_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 of the plugin, or a module called 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 blazing fast, exactly the same as if it were hard-coded from the beginning. Calls to plugin callbacks not implemented in any plugin go directly to the default NkACTOR implementation.

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

Modules

Modules are scripts written in Luerl, that can start and configure any number of Packages, and then use them with any custom logic. The policy for launching this instances depends on the package. For example, the Rest package launches a module for each request, while the Kafka consumer group launches one for each topic & partition.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published