The NoPE-Dispatcher is designed as Layer between the different Modules / Dispatchers. They allow distributed computing or just a simple Service oriented Architecture (SOA). A dispatcher is used to link the modules, share data and events and provide a remote procedure call (rpc) interface.
establishes a connection to other dispatchers and manages the status of the remotely connected dispatchers. It checks their health and removes dead dispatchers.
shares events accross the network (or internally). You can use this element to listen for specific events. The subscription to those events allows mqtt-patterns. Additionaly, you are allowed to emit event on specific topics, or pattern based topics
shares data accross the network (or internally). In comperisson to events, data is persistent and is available all the time. You can use this sub-module to listen for specific data-changes (install data-hooks), pull specific data or push data. You can pull / push data using a mqtt-pattern based path.
Used to perform remote procedure calls (see here). The manager keeps track of the available services. You must use the sub-module to register/unregister (new) services.
Used to create/dispose (remote) instances. The manager keeps track of the available instances in the network, allows to create wrappers for those instances. You must use the sub-module to register/unregister (new) instances. To allow the system to provide a service for creating instances of as specific type, you can provide a generator and provide it as service.
To start exploring the capabilities of the dispatcher we will firstly create a dispatcher with the code below:
// First lets install nope using npm constnope = require("../dist-nodejs/index.nodejs")
// Lets create our dispatcher constdispatcher = nope.dispatcher.getDispatcher({ // We will use the event layer (which just runs internally) communicator:nope.getLayer("event"),
// We will adapt the timings (normally, we send a hartbeat and check for dead dispatchers) timings: {
// Interval for the alive message given in [ms]. If "0" is provided, // no alive messages are provided sendAliveInterval:0,
// Interval, to check the other dispatcher for being slow, dead, etc.. // should be lager then the "sendAliveInterval". The value is given in [ms] // If "0" is provided, no alive messages are provided checkInterval:0
To play with a dispatcher, you can use the nope-js repl tool. this tool creates a dispatcher and you are able to interact with the dispatcher in an interactive console.
Author
Martin Karkowski
Email
m.karkowski@zema.de
NoPE - Dispatcher
The NoPE-Dispatcher is designed as Layer between the different Modules / Dispatchers. They allow distributed computing or just a simple Service oriented Architecture (SOA). A dispatcher is used to link the modules, share data and events and provide a remote procedure call (rpc) interface.
Building Blocks of a Dispatcher:
connectivityManager
: connectivityManagereventDistributor
: PubSubSystemmqtt
-patterns. Additionaly, you are allowed to emit event on specific topics, or pattern based topicsdataDistributor
: DataPubSubSystemmqtt
-pattern based path.rpcManager
: rpcManagerremote procedure calls
(see here). The manager keeps track of the available services. You must use the sub-module to register/unregister (new) services.instanceManager
: instanceManagerwrappers
for those instances. You must use the sub-module to register/unregister (new) instances. To allow the system to provide a service for creating instances of as specific type, you can provide a generator and provide it asservice
.Create a Dispatcher
To start exploring the capabilities of the dispatcher we will firstly create a dispatcher with the code below:
Settings for creating:
The relevant Settings are described by the INopeDispatcherOptions. This options allows to define:
getLayer
to receive a bridge with the specified layer)id
heartbeats
andchecks
(see INopeINopeConnectivityTimeOptions for more details)defaultSelector
which is used as selector for a service providePlaying with the dispatcher:
To play with a dispatcher, you can use the
nope-js
repl tool. this tool creates adispatcher
and you are able to interact with the dispatcher in an interactive console.