WeePub v0.1.0 WeePub.Subscriber View Source
Creates a GenServer
that registers subscriptions with WeePub.Broadcaster
Link to this section Summary
Functions
Creates a handle_cast
function that will accept messages matching the
pattern and the where:
clause if present
Link to this section Functions
Creates a handle_cast
function that will accept messages matching the
pattern and the where:
clause if present.
Note: The GenServer state is implicitly set to the result of the body of the macro.
subscribe %{id, id} = message, where: id = 42 do
... processes the message
end
will be transformed to
def handle_cast(%{id, id} = message, state) when id = 42 do
state = ... process the message
{:noreply, state}
end
The pattern and Module will be registered with WeePub.Broadcaster
as part of the generated init
function.
The where:
clause is optional but when included needs to obey the
same restrictions as a when
guard clause.