Reference Source
public class | source

NodeMessaging

Extends:

devapt-core-common/dist/js/base/distributed_instance~DistributedInstance → NodeMessaging

Direct Subclass:

Node

Node messaging base class.

Constructor Summary

Public Constructor
public

constructor(arg_name: string, arg_settings: object, arg_log_context: string): nothing

Create a Node messaging instance.

Member Summary

Public Members
public

Is master flag.

public

Class type flag.

public

Master name.

public

state: *

Method Summary

Public Methods
public

Find master node.

public

get_logs_bus(): BusClient | BusServer

Get metrics bus client or server instance.

public

get_metrics_bus(): BusClient | BusServer

Get metrics bus client or server instance.

public

get_msg_bus(): BusClient | BusServer

Get metrics bus client or server instance.

public

Promote this node to master node.

public

register_to_master(): nothing

Register this node to master node.

public

Revoke this node from master node.

public

send_msg_to_master(arg_payload: object): nothing

Send a message to master node through a bus.

public

switch_state(arg_state: string): nothing

Switch Node state.

public

Unegister this node from master node.

Public Constructors

public constructor(arg_name: string, arg_settings: object, arg_log_context: string): nothing source

Create a Node messaging instance.

Params:

NameTypeAttributeDescription
arg_name string

resource name.

arg_settings object

resource settings.

arg_log_context string

trace context string (optional, default=context).

Return:

nothing

Public Members

public is_master: boolean source

Is master flag.

public is_node_messaging: boolean source

Class type flag.

public master_name: string source

Master name.

public state: * source

Public Methods

public find_master(): Node source

Find master node. (TODO)

Return:

Node

master node instance.

public get_logs_bus(): BusClient | BusServer source

Get metrics bus client or server instance.

Return:

BusClient | BusServer

Metrics bus client or server.

public get_metrics_bus(): BusClient | BusServer source

Get metrics bus client or server instance.

Return:

BusClient | BusServer

Metrics bus client or server.

public get_msg_bus(): BusClient | BusServer source

Get metrics bus client or server instance.

Return:

BusClient | BusServer

Metrics bus client or server.

public promote_master(): Promise source

Promote this node to master node. (TODO)

Return:

Promise

Promise of boolean: success or failure

public register_to_master(): nothing source

Register this node to master node.

Return:

nothing

public revoke_master(): Promise source

Revoke this node from master node. (TODO)

Return:

Promise

Promise of boolean: success or failure

public send_msg_to_master(arg_payload: object): nothing source

Send a message to master node through a bus.

Params:

NameTypeAttributeDescription
arg_payload object

content of the message to send.

Return:

nothing

public switch_state(arg_state: string): nothing source

Switch Node state.

Params:

NameTypeAttributeDescription
arg_state string

target state.

Return:

nothing

public unregister_to_master(): nothing source

Unegister this node from master node. (TODO)

Return:

nothing