Page tree

SAYMON документация

Skip to end of metadata
Go to start of metadata

The SAYMON architecture allows users to develop server extensions that add the functionality, they need, to SAYMON. The example of such functionality may be additional data collectors that quering special equipment or modules that send notifications to the channels that a customer needs (for example, syslog or Jabber chat).

Each user extension is an actor written in JavaScript or TypeScript. This actor is loaded by the SAYMON server at startup. All internal APIs that are used inside the SAYMON server are available to it.

For more information on how to develop server extensions — actors — see in the examples of this section.


As already mentioned, the server extension is an actor. Actor is a module that can:

  • receive messages;
  • send messages:
  • spawn child actors.

The main property of the actor is its complete isolation from other modules and the ability to communicate with these modules only through messages. This allows flexible scaling of actors depending on the load.

SAYMON server uses the actor model for server extensions, since it itself is implemented according to the actor model. The Comedy library is used as an implementation of the actor model. To develop server extensions, you must be familiar with this library.

Simple example

The simplest example of a custom extension is a module that sends a greeting to a log. This example looks like this:

class HelloWorldActor {
  initialize(selfActor) {
    selfActor.getLog().info('Hello, world!');

module.exports = HelloWorldActor;

In order to load the above module into SAYMON, you need to save the code to a file (say, /tmp/saymon-modules/hello-world-actor.js), write the parameter "extension_path" to the server configuration: "/ tmp / saymon- modules "(full directory), and then restart the SAYMON server.

  "server": {
    "extension_path": "/tmp/saymon-modules"

After that, the following message will appear in the SAYMON server log:

Thu Dec 20 2018 11:46:04 GMT+0300 - info: InMemoryActor(5c1b56ccf06c7b030664ff5b, HelloWorldActor): Hello, world!

More detailed examples:

  • No labels