Class: FakeMessageBus
Hierarchy
-
↳ FakeMessageBus
Implements
Table of contents
Constructors
Methods
Constructors
constructor
+ new FakeMessageBus(reactors?
: Reactor[]): FakeMessageBus
Parameters:
Name | Type |
---|---|
reactors |
Reactor[] |
Returns: FakeMessageBus
Inherited from: Fake
Methods
Dispatch
▸ Dispatch(): void
Dispatch processes the current message bus queue and forwards the messages to the subscribers who have subscribed to each message type.
Returns: void
DispatchUntilEmpty
▸ DispatchUntilEmpty(): void
DispatchUntilEmpty repeatedly dispatches until the message queue is empty, used to make sure everything is processed, e.g. if there is a message that causes a new message to be added, it will ensure that all recursive messages are processed.
Returns: void
Publish
▸ Publish(message
: IMessage): void
Publish adds a message to the message bus queue to be dispatched.
Parameters:
Name | Type |
---|---|
message |
IMessage |
Returns: void
Subscribe
▸ Subscribe(subscriber
: Subscriber, types
: string | string[]): void
Subscribe subscibes a subscriber to a particular message type or types.
Parameters:
Name | Type |
---|---|
subscriber |
Subscriber |
types |
string | string[] |
Returns: void
Unsubscribe
▸ Unsubscribe(subscriber
: Subscriber, types
: string | string[]): void
Unsubscribe unsubscribes a subscriber from a specific message type or types.
Parameters:
Name | Type |
---|---|
subscriber |
Subscriber |
types |
string | string[] |
Returns: void
UnsubscribeAll
▸ UnsubscribeAll(subscriber
: Subscriber): void
UnsubscribeAll unsubscribes a Subscriber from all messages.
Parameters:
Name | Type |
---|---|
subscriber |
Subscriber |
Returns: void