Exchange v0.2.1 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

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
Link to this function

cast_event(atom, payload)

View Source

Specs

cast_event(
  :order_cancelled
  | :order_expired
  | :order_placed
  | :order_queued
  | :price_broadcast
  | :trade_executed
  | :trade_processed,
  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

Specs

remove_listener(any()) :: :error | :ok

Removes the process calling this function to the Registry

Parameters

  • key: Event to register the process
Link to this function

validate_config(config \\ [])

View Source