redis

api. redis

Source:
Properties:
Name Type Description
clients Object

Holds the redis clients. Contains 3 redis connections: 'client', 'subscriber' and 'tasks'. Configured via api.config.redis.

Properties
Name Type Description
client Object

The main redis connection. Use this if you need direct access to redis.

subscriber Object

A Redis connection only listeneing for reids pub/sub events.

tasks Object

A Redis connection for use only in the task ssytem.

subscriptionHandlers Object

Callbacks for redis pub/sub

rpcCallbacks Object

RPC callbacks for responses to other clients

status Object

Redis connection statuses

Redis helpers and connections.

Extends

Methods

(async, static) doCluster(method, args, connectionId, waitForResponse) → {Promise}

Source:

Invoke a command on all servers in this cluster.

Parameters:
Name Type Description
method string

The method to call on the remote server.

args Array

The arguments to pass to method

connectionId string

(optional) Should this method only apply to a server which connectionId is connected to?

waitForResponse Boolean

(optional) Should we await a response from a remote server in the cluster?

Returns:

The return value from the remote server.

Type
Promise

(async, static) publish(payload) → {Promise}

Source:

Publish a message to all other ActionHero nodes in the clsuter. Will be autneticated against api.config.serverToken

Example
let payload = {
  messageType: 'myMessageType',
  serverId: api.id,
  serverToken: api.config.general.serverToken,
  message: 'hello!'
}

await api.redis.publish(payload)
Parameters:
Name Type Description
payload Object

The message to send. Must include serverToken

Returns:
Type
Promise