exda v0.1.0 Exda.GenServerConsumer
This GenServerConsumer is used by specifying the event names
that can be processed by this event. to as well as a restart type which will
be used to create a child spec for any module uses GenServerConsumer
.
Using
To create a module that is suitable to be put into a supervisor you should use:
defmodule SomeApp.SomeModule do
use Exda.GenServerConsumer, [:message_sent]
@impl true
def consume_message_sent(event_data) do
Logger.info("Got event!")
:ok
end
end
To create a GenServer that will be lazily started upon the first message produced.
This consumer type will only be necessary if an only if you are using the
AsyncCastGenServer
bus.
Event Consumer
Based on the above configuration you will need to declare a function: consume_message_sent/1
that will process each individual recieved message.