Exchange v0.2.5 Exchange.Adapters.EventBus View Source
Public API to use the adapter of Exchange.MessageBus
, the Event Bus.
This module uses the Registry to un/register processes under a event and send messages to the registered processes.
Link to this section Summary
Functions
Adds the process calling this function to the Registry
under the given key
Sends a message to all registered processes under the permitted events.
The payload
is sent through the Registry
module using dispatch/3
Callback implementation for Exchange.MessageBus.init/0
.
Removes the process calling this function to the Registry
Link to this section Functions
Specs
add_listener(any()) :: :error | :ok
Adds the process calling this function to the Registry
under the given key
Parameters
- key: Event to register the process
Specs
cast_event( :order_cancelled | :order_expired | :order_queued | :price_broadcast | :trade_executed, any() ) :: nil | :ok
Sends a message to all registered processes under the permitted events.
The payload
is sent through the Registry
module using dispatch/3
Parameters
- key: Payload's event type
- payload: Data to be sent to the processes
Callback implementation for Exchange.MessageBus.init/0
.
Specs
remove_listener(any()) :: :error | :ok
Removes the process calling this function to the Registry
Parameters
- key: Event to register the process