event_bus v0.3.1 EventBus

Simple event bus implementation.

Link to this section Summary

Functions

Send the event processing completed to the watcher

Send the event processing skipped to the watcher

Send event to all listeners

Subscribe to the bus

List the subscribers to the bus

Unsubscribe from the bus

Link to this section Functions

Link to this function fetch_event_data(event_shadow)
fetch_event_data(tuple) :: any

Fetch event data

Examples

EventBus.fetch_event_data({:hello_received, "123"})
Link to this function mark_as_completed(event_with_listener)
mark_as_completed(tuple) :: no_return

Send the event processing completed to the watcher

Examples

EventBus.mark_as_completed({MyEventListener, :hello_received, "123"})
Link to this function mark_as_skipped(event_with_listener)
mark_as_skipped(tuple) :: no_return

Send the event processing skipped to the watcher

Examples

EventBus.mark_as_skipped({MyEventListener, :unmatched_occurred, "124"})
Link to this function notify(event)
notify({:atom, any}) :: :ok

Send event to all listeners.

Examples

EventBus.notify({:webhook_received, %{"message" => "Hi all!"}})
:ok
Link to this function subscribe(subscriber)
subscribe(tuple) :: :ok

Subscribe to the bus.

Examples

EventBus.subscribe({MyEventListener, [".*"]})
:ok
Link to this function subscribers()
subscribers() :: [any]

List the subscribers to the bus.

Examples

EventBus.subscribers()
[MyEventListener]
Link to this function unsubscribe(listener)
unsubscribe(any) :: :ok

Unsubscribe from the bus.

Examples

EventBus.unsubscribe(MyEventListener)
:ok