event v0.1.0 Event.Processor behaviour

Receives events from Event.Source or Event.Processor before passing them on to the next connected event handler(s)

Link to this section Summary

Functions

Asynchronously notify the processor that an event has occurred. Returns immediately

Send a message to the event processor and await a response

Send an asynchronous message to the event processor

Handle a synchronous event notification

Handle an asynchronous event notification

Handle incoming events

Handle an incoming message

Initialize event processor state

Start an EventProcessor process

Synchronously notify the processor that an event has occurred. This call will block until the event has been consumed, or until the timeout is reached

Handle process termination

Link to this section Types

Link to this type from()
from() :: {pid(), subscription_tag()}
Link to this opaque subscription_tag() (opaque)

Link to this section Functions

Link to this function async_notify(processor, event)

Asynchronously notify the processor that an event has occurred. Returns immediately.

Link to this function call(processor, call, timeout \\ 5000)

Send a message to the event processor and await a response.

Link to this function cast(processor, cast)

Send an asynchronous message to the event processor

Link to this function code_change(old_version, state, extra)

Handle a code change

Link to this function handle_call(call, from, state)

Handle a synchronous event notification

Link to this function handle_cast(call, state)

Handle an asynchronous event notification

Link to this function handle_events(events, from, state)

Handle incoming events

Link to this function handle_info(info, state)

Handle an incoming message

Link to this function handle_subscribe(subscriber, opts, from, state)

Handle a subscription

Initialize event processor state

Link to this function start_link(module, args, opts)

Start an EventProcessor process.

Link to this function sync_notify(processor, event, timeout \\ 5000)

Synchronously notify the processor that an event has occurred. This call will block until the event has been consumed, or until the timeout is reached

Link to this function terminate(reason, arg2)

Handle process termination

Link to this section Callbacks

Link to this callback code_change(old_vsn, state, extra) (optional)
code_change(old_vsn, state :: term(), extra :: term()) ::
  {:ok, new_state :: term()} | {:error, reason :: term()}
when old_vsn: term() | {:down, term()}
Link to this callback handle_call(request, from, state) (optional)
handle_call(request :: term(), from :: GenServer.from(), state :: term()) ::
  {:reply, reply, new_state}
  | {:reply, reply, [event], new_state}
  | {:reply, reply, [event], new_state, :hibernate}
  | {:noreply, new_state}
  | {:noreply, [event], new_state}
  | {:noreply, [event], new_state, :hibernate}
  | {:stop, reason, reply, new_state}
  | {:stop, reason, new_state}
when reply: term(), new_state: term(), reason: term(), event: term()
Link to this callback handle_cast(request, state) (optional)
handle_cast(request :: term(), state :: term()) ::
  {:noreply, new_state}
  | {:noreply, [event], new_state}
  | {:noreply, [event], new_state, :hibernate}
  | {:stop, reason :: term(), new_state}
when new_state: term(), event: term()
Link to this callback handle_events(events, from, state) (optional)
handle_events(events :: [event], from(), state :: term()) ::
  {:noreply, [event], new_state}
  | {:noreply, [event], new_state, :hibernate}
  | {:stop, reason, new_state}
when new_state: term(), reason: term(), event: term()
Link to this callback handle_info(message, state) (optional)
handle_info(message :: term(), state :: term()) ::
  {:noreply, new_state}
  | {:noreply, [event], new_state}
  | {:noreply, [event], new_state, :hibernate}
  | {:stop, reason :: term(), new_state}
when new_state: term(), event: term()
Link to this callback terminate(reason, state) (optional)
terminate(reason, state :: term()) :: term()
when reason: :normal | :shutdown | {:shutdown, term()} | term()