MessageBus
Extends:
Constructor Summary
Public Constructor | ||
public |
constructor(registry: *) |
Member Summary
Public Members | ||
public get |
pipeline: * |
Method Summary
Public Methods | ||
public |
addForward(from: URL, to: URL): * Adds a forward listener for a message destination. |
|
public |
addPublish(from: URL): * Adds an external publish address listener. |
|
public |
forward(url: URL, msg: Message) Just forward's a message to the forward address. Listeners should be available for the forward address. |
|
public |
postMessage(inMsg: Message, responseCallback: Callback): number Post a message for routing. |
Inherited Summary
From class Bus | ||
public |
addListener(url: URL, listener: Listener): MsgListener Register listener to receive message when "msg.to === url". |
|
public |
addResponseListener(url: URL, msgId: number, responseListener: Function) Manually add a response listener. |
|
public |
Helper method to bind listeners (in both directions) into other MiniBus target. |
|
public |
postMessage(msg: Message, responseCallback: Function): number Send messages to local listeners, or if not exists to external listeners. |
|
public |
removeAllListenersOf(url: URL) Remove all existent listeners for the URL |
|
public |
removeResponseListener(url: URL, msgId: number) Remove the response listener. |
Public Constructors
public constructor(registry: *) source
Override:
Bus#constructorParams:
Name | Type | Attribute | Description |
registry | * |
Public Members
public get pipeline: * source
Public Methods
public addForward(from: URL, to: URL): * source
Adds a forward listener for a message destination. Every message reaching an address will be also sent to the forward address.
Params:
Name | Type | Attribute | Description |
from | URL | Message destination, it's actually the field "to" of the message. |
|
to | URL | Forward address. |
Return:
* |
public addPublish(from: URL): * source
Adds an external publish address listener. Every message for the address will be forwarded to the external routing by _onPostMessage. This means, even if there is a listener for the address, it will also send the message to the external routing.
Params:
Name | Type | Attribute | Description |
from | URL | Publish address. |
Return:
* |
public forward(url: URL, msg: Message) source
Just forward's a message to the forward address. Listeners should be available for the forward address.
Params:
Name | Type | Attribute | Description |
url | URL | Forward address. |
|
msg | Message | Message to forward |
public postMessage(inMsg: Message, responseCallback: Callback): number source
Post a message for routing. It will first search for a listener, if there is no one, it sends to a external routing using the _onPostMessage. External routing use the registry.resolve(..) method to decide the destination sandbox.
Override:
Bus#postMessageParams:
Name | Type | Attribute | Description |
inMsg | Message | JSON with mandatory Message structure {id, type, from, to} |
|
responseCallback | Callback | Optional callback if a response is expected from the request. A response will be always sent, even if it is a "Timeout". |