Broadcast

Service that is responsible to relaying messages to members of the application server cluster. The broadcast service is instructed to publish messages to members of the application server. Application server member services subscribe to these messages, receive them and act on them.

Modes

The Cloud CMS Application Server can run in one of three modes:

  • single node
  • multiple nodes (on a single process)
  • cluster (multiple processes)

In a single node configuration, the broadcast service raises events that are subscribed to by services running by the very same process.

In multiple mode (which uses the Node cluster module under the hood), a single message is distributed to N number of forked workers running on N number of CPUs.

In cluster mode, there may be M number of servers, each running N forked workers (where N >= 1). The broadcast service distributes across the cluster such that a message published to any one instance of the service is received by every server and acted upon by every process subscriber.

Essential Configuration

{
    "broadcast": {
        "enabled": <boolean>,
        "type": "<type>",
        "config": {
            ...configuration
        }
    }
}

There are two types of broadcast providers:

  • local - works for single and multiple mode within a single machine
  • redis - uses Redis to broadcast messages across a cluster

Local Provider

No configuration is required for this provider.

Example:

{
    "setup": "single",
    "broadcast": {
        "enabled": true,
        "type": "local"
    }
}

Redis Provider

{
    "setup": "cluster",
    "broadcast": {
        "enabled": true,
        "type": "redis",
        "config": {
            "endpoint": "<Redis endpoint URL>",
            "port": <Redis port>
        }
    }
}