MessageBus
Extends:
Constructor Summary
Public Constructor | ||
public |
constructor(arg_name: string, arg_bus_engine: BusEngine, arg_settings: object, arg_log_context: string): nothing Create a bus. |
Member Summary
Public Members | ||
public |
Class type flag. |
Private Members | ||
private |
_bus_engine: * |
|
private |
|
|
private |
_recipients: {} |
|
private |
|
Method Summary
Public Methods | ||
public |
Get bus engine. |
|
public |
Get stream to populate the bus. |
|
public |
msg_add_recipient(arg_name: string, arg_instance: DistributedInstance): nothing Add a recipient. |
|
public |
msg_has_recipient(arg_name: arg_name): boolean Test if bus has given named recipient. |
|
public |
msg_post(arg_msg: DistributedMessage): boolean Send a message into a channel. |
|
public |
msg_recipients(arg_page_size: integer, arg_page_index: integer): object Get paged recipients list. |
|
public |
msg_register(arg_distributed_instance: DistributedInstance, arg_channel: string, arg_method: string, arg_alias: string): function Register a DistributedInstance recipient. |
|
public |
msg_remove_recipient(arg_name: string): nothing Remove a recipient. |
|
public |
Subscribe on channel inputs. |
|
public |
normalize_msg(arg_msg: object): DistributedMessage | undefined Normalize given message. |
Inherited Summary
From class Loggable | ||
public |
Log context. |
|
public |
Class type flag. |
|
public |
Trace is enabled for this flag. |
|
private |
Logger manager instance (default undefined) |
|
public |
Trace DEBUG formatted message. |
|
public |
disable_trace(): nothing Disable traces. |
|
public |
enable_trace(): nothing Enable traces. |
|
public |
enter_group(arg_group: string): nothing Trace INFO message on "enter trace group". |
|
public |
Trace ERROR formatted message. |
|
public |
Define get class name method for non Instance classes. |
|
public |
Get instance context. |
|
public |
Get logger manager. |
|
public |
Define get instance name method for non Instance classes. |
|
public |
Get trace flag. |
|
public |
Trace INFO formatted message. |
|
public |
leave_group(arg_group: string): nothing Trace INFO message on "leave trace group". |
|
public |
separate_level_1(): nothing Trace INFO trace level 1 separator. |
|
public |
separate_level_2(): nothing Trace INFO trace level 2 separator. |
|
public |
separate_level_3(): nothing Trace INFO trace level 3 separator. |
|
public |
Set trace flag. |
|
public |
should_trace(arg_traces_cfg: object): boolean Calculate should trace flag. |
|
public |
should_trace_class(arg_traces_cfg: object): boolean Calculate should trace flag for classes. |
|
public |
should_trace_collection_item(arg_traces_cfg: object, arg_collection_name: string, arg_this_item_accessor: string): boolean Calculate should trace flag for given collection of names or patterns. |
|
public |
should_trace_module(arg_traces_cfg: object): boolean Calculate should trace flag for modules. |
|
public |
should_trace_name(arg_traces_cfg: object): boolean Calculate should trace flag for instances names. |
|
public |
Toggle trace flag. |
|
public |
update_trace_enabled(): nothing Update trace enabled flag. |
|
public |
Trace WARN formatted message. |
From class Errorable | ||
private |
Error text (default null). |
|
private |
Has error flag (default false). |
|
public |
Set an error. |
|
public |
Default helper for "not implemented" error. |
|
public |
Get error message. |
|
public |
Test is an error is set. |
From class Settingsable | ||
public |
Instance settings (default undefined). |
|
public |
Class type flag. |
|
public |
get_setting(arg_name: string | array, arg_default: any): any Get a value in settings for given key. |
|
public |
get_setting_js(arg_name: string | array, arg_default: any): any Get a value in settings for given key. |
|
public |
get_settings(): Immutable.Map Get instance settings. |
|
public |
get_settings_js(): Immutable.Map Get instance settings. |
|
public |
has_setting(arg_name: string): boolean Test if a key exists in settings. |
|
public |
set_setting(arg_name: string, arg_value: any): nothing Set a value in settings for given key. |
|
public |
set_settings(arg_settings: Immutable.Map): nothing Set instance settings. |
From class Stateable | ||
public |
Class type flag. |
|
public |
state_path: array State path in runtime state. |
|
private |
Initial state. |
|
private |
_runtime: Runtime Runtime isntance. |
|
private |
State store. |
|
private |
_state_value_listeners: array State changes handlers. |
|
public |
dispatch_action(arg_action_type: string | object, arg_options: object | undefined): nothing Dispatch a state action. |
|
public |
get_initial_state(): Immutable.Map Get initial state, an immutable object from a Redux data store. |
|
public |
Get name. |
|
public |
Get runtime instance. |
|
public |
get_state(): Immutable.Map Get current state, an immutable object from a Redux data store. |
|
public |
Get current state, an immutable object from a Redux data store. |
|
public |
get_state_path(): array Get state path into a Redux data store. |
|
public |
Get state store. |
|
public |
get_state_value(arg_key_or_path: string | array, arg_default_value: any): any Get a state entry. |
|
public |
handle_state_change(arg_previous_state: Immutable.Map, arg_new_state: Immutable.Map): nothing Handle component state changes. |
|
public |
register_state_value_change_handle(arg_path: string | array, arg_listener: string | function): nothing Register a state value change listener. |
From class Instance | ||
public |
Instance class name. |
|
public |
Instance id. |
|
public |
Instance name. |
|
public |
Instance collection name. |
|
public |
Class type flag. |
|
public |
Instance is loaded flag. |
|
public |
Get instance class. |
|
public |
Get instance description: {$type:..., $class:..., $id:..., $name:...}. |
|
public |
Get instance description string: $type:..., $class:..., $id:..., $name:.... |
|
public |
Get instance unique id. |
|
public |
Get instance unique name. |
|
public |
Get instance type. |
|
public |
Test if this code run inside a browser. |
|
public |
Test if this code run on a browser. |
|
public abstract |
load(): nothing Load instance settings. |
Public Constructors
public constructor(arg_name: string, arg_bus_engine: BusEngine, arg_settings: object, arg_log_context: string): nothing source
Create a bus.
API: ->constructor(arg_name, arg_settings, arg_log_context).
Engine API:
->get_bus_engine():BusEngine
Stream API:
->get_input_stream():Stream - get input stream to populate the bus.
Message API:
->msg_recipients(arg_page_size=999999, arg_page_index=0):array - get paged recipients list.
->msg_post(arg_msg:DistributedMessage):boolean - send a DistributedMessage instance.
->msg_subscribe(arg_channel:string, arg_handler:f(msg), arg_filter:string|object):unsubscribe function - subscribe to messages of the bus.
->msg_register(arg_distributed_instance,arg_channel,arg_method='receive_msg'):function - register a DistributedInstance recipient. ->msg_has_recipient(arg_name):boolean - test if the bus has given named recipient. ->msg_add_recipient(arg_name, arg_instance='remote') - add a bus recipient. ->msg_remove_recipient(arg_name) - remove a bus recipient.
->normalize_msg(arg_msg):DistributedMessage|undefined - Normalize given message.
Override:
Instance#constructorReturn:
nothing |
Public Members
Private Members
private _bus_engine: * source
private _input_stream: * source
private _recipients: {} source
private _recipients_handlers: {} source
Public Methods
public msg_add_recipient(arg_name: string, arg_instance: DistributedInstance): nothing source
Add a recipient.
Params:
Name | Type | Attribute | Description |
arg_name | string | recipient name. |
|
arg_instance | DistributedInstance | distributed recipient instance (default:'remote'). |
Return:
nothing |
public msg_has_recipient(arg_name: arg_name): boolean source
Test if bus has given named recipient.
Params:
Name | Type | Attribute | Description |
arg_name | arg_name | recipient name. |
public msg_post(arg_msg: DistributedMessage): boolean source
Send a message into a channel.
Params:
Name | Type | Attribute | Description |
arg_msg | DistributedMessage | distributed message instance. |
public msg_recipients(arg_page_size: integer, arg_page_index: integer): object source
Get paged recipients list.
Params:
Name | Type | Attribute | Description |
arg_page_size | integer | recipients list page size. |
|
arg_page_index | integer | recipients list page index. |
Return:
object | paged result { count:recipients count, page_size:..., page_count:..., page_index:..., page_values:[] } |
public msg_register(arg_distributed_instance: DistributedInstance, arg_channel: string, arg_method: string, arg_alias: string): function source
Register a DistributedInstance recipient.
Params:
Name | Type | Attribute | Description |
arg_distributed_instance | DistributedInstance | distributed recipient instance. |
|
arg_channel | string | channel name string. |
|
arg_method | string | message handler method name string. |
|
arg_alias | string | instance alias name string (optional, default undefined). |
public msg_remove_recipient(arg_name: string): nothing source
Remove a recipient.
Params:
Name | Type | Attribute | Description |
arg_name | string | recipient name. |
Return:
nothing |
public msg_subscribe(arg_channel: string, arg_handler: function, arg_filter: string | function): function source
Subscribe on channel inputs.
public normalize_msg(arg_msg: object): DistributedMessage | undefined source
Normalize given message.
Params:
Name | Type | Attribute | Description |
arg_msg | object | message to normalize. |