neuroevolution_events_local (faber_neuroevolution v1.2.4)
View SourceLocal event backend using Erlang's pg (process groups).
This is the default backend for single-node or development use. For distributed operation, use neuroevolution_events_macula.
Message Format
Subscribers receive messages in the format: {neuro_event, Topic, Event}
Example
Subscribe to events: neuroevolution_events:subscribe(Topic)
In handle_info: handle_info({neuro_event, Topic, Event}, State) -> io:format("Received ~p on ~p~n", [Event, Topic]), {noreply, State}.
Summary
Functions
Publish an event to all subscribers of a topic.
Start the local event system.
Subscribe a process to a topic.
Unsubscribe a process from a topic.
Functions
Publish an event to all subscribers of a topic.
-spec start() -> ok.
Start the local event system.
This must be called once at application startup to initialize the pg scope. It's safe to call multiple times.
Subscribe a process to a topic.
Unsubscribe a process from a topic.