Search code examples
node.jsautobahncrossbar

Dynamically add new guest worker with crossbar.io


I was thinking about if crossbar.io is able to dynamically add guest workers when a new file is available in the watch directory. And I could not find an answer in the crossbar.io documentation.

It is advertising with Crossbar.io has a multi-node and multi-process architecture. but I could not find an information if it is necessary to restart the whole crossbar instance when adding a guest worker.

The configuration for a guest worker looks like this:

{
     "type": "guest",
     "executable": "node",
     "arguments": ["hello.js"],
     "options": {
        "workdir": "../node",
        "watch": {
           "directories": ["../node"],
           "action": "restart"
        }
     }
}

and it seems that it will restart the worker (while crossbar instance is running) when there is a change in the directory "../node". But what about adding a completely new worker.

Is is necessary to restart the crossbar instance or is there a possibility to load the new worker while instance is running?


Solution

  • The ability to dynamically start guest workers is an upcoming feature of the (experimental as of 2015/01) management API (see crossbar.node.<node_id>.start_guest).

    As said, this is experimental, non-official and will still change. But it should give you a glimpse of what is coming.