This application is an intermediate broker for our City Simulator.
It receives messages from the middleware and is responsible of processing the information in them to keep the useful data and enrich them with topics which have a more powerful semantic than the original topics (which were defined at middleware level).
An application server receives the messages from a broker, which is therefore basically a lightweight unit of dispatching and enrichment.
You can see its simple structure in the lib/
directory: it just has a
GenStage pipeline through which messages are received from the middleware
RabbitMQ, processed by deep inspection and then forwarded with a RabbitMQ
broker shared with the application server.
The pipeline is fed by two different kinds of Elixir processes, which are
Daemon
and BackendControlListener
. While the former listens for messages
which semantics depends on the application logic, the latter forwards
control messages which arrives from the backend (e.g., notification of
boot completion).
The Broker application also provides a communication means from the Application Server to the backend corresponding to one city C. This channel is used by the application server to send control commands, e.g., to kickoff the simulation if there is a user interested in a given city.
You may want to define your own type of events: just define a new extractor
(which is likely to be similar to the others in
lib/utils/deep_inspection/extractors
) and add it to the available extractors
in BrokerToAs.Utils.DeepInspection
.