Reference Source
import DistributedMessage from 'devapt-core-common/js/base/distributed_message.js'
public class | source

DistributedMessage

DistributedMessage class for distributed communication.

Example:

	API:
		->get_channel():string - get bus channel name.
		->set_channel(arg_channel):nothing - set bus channel name.
		->get_sender():string - Get message sender.
		->...

Constructor Summary

Public Constructor
public

constructor(arg_sender_name: string | object, arg_target_name: string, arg_payload: object, arg_channel: string, arg_buses_path: array): nothing

Create a DistributedMessage instance.

Member Summary

Public Members
public

Class type flag.

Private Members
private

_buses_path: array

Message buses path.

private

Message channel name.

private

Message payload object.

private

Message sender name.

private

Message target name.

Method Summary

Public Methods
public

add_buses_step(arg_bus_name: string): nothing

Add a step to message buses path.

public

Check message format.

public

Get bus channel name.

public

Get message sender.

public

Get message sender.

public

Get message sender.

public

has_buses_step(arg_bus_name: string): nothing

Test if message has a step into buses path.

public

set_channel(arg_channel: string): nothing

Set bus channel name.

Public Constructors

public constructor(arg_sender_name: string | object, arg_target_name: string, arg_payload: object, arg_channel: string, arg_buses_path: array): nothing source

Create a DistributedMessage instance.

Params:

NameTypeAttributeDescription
arg_sender_name string | object

sender name or message plain object (without other args).

arg_target_name string

recipient name.

arg_payload object

message payload plain object.

arg_channel string

channel name.

arg_buses_path array

message buses path (optional default []).

Return:

nothing

Public Members

public is_distributed_message: boolean source

Class type flag.

Private Members

private _buses_path: array source

Message buses path.

private _channel: string source

Message channel name.

private _payload: object source

Message payload object.

private _sender: string source

Message sender name.

private _target: string source

Message target name.

Public Methods

public add_buses_step(arg_bus_name: string): nothing source

Add a step to message buses path.

Params:

NameTypeAttributeDescription
arg_bus_name string

message step bus name.

Return:

nothing

public check_msg_format(): boolean source

Check message format.

Return:

boolean

true:good format, false:bad format.

public get_channel(): string source

Get bus channel name.

Return:

string

public get_payload(): object source

Get message sender.

Return:

object

payload object

public get_sender(): string source

Get message sender.

Return:

string

sender name.

public get_target(): string source

Get message sender.

Return:

string

target name.

public has_buses_step(arg_bus_name: string): nothing source

Test if message has a step into buses path.

Params:

NameTypeAttributeDescription
arg_bus_name string

message step bus name.

Return:

nothing

public set_channel(arg_channel: string): nothing source

Set bus channel name.

Params:

NameTypeAttributeDescription
arg_channel string

bus channel name.

Return:

nothing