This project is currently under development. If you wish to contribute, please join our Discord located at: https://discord.gg/7xF65ap and check out the channel #if-you-wish-to-contribute.
NOTE: After you have cloned this repository, you also need to install the git submodule which contain various constants used across the PS2Alerts repositories. Simply execute
git submodule update --init --recursive
If in the future your application is performing weird saying it can't find references to things, pull the latest modules in via running ./module-update.sh
.
To start the environment for the first time, execute ps2alerts-api-init
. If you don't have this command available, pull in the Stack and follow the instructions there to get set up properly.
tl;dr:
ps2alerts-stack-start
if stack not already started. If you wish to see output of this module, run ps2alerts-api-dev
.
The API is a very dumb overlay over MongoDB, which inserts and updates data. It acts as a single source of truth for data access.
The PS2Alerts Aggregator consumes data coming in from the Census Streaming Service and generates aggregates / statistics for us to store.
The Aggregator service pushes the data to the API over a RabbitMQ queue. The API consumes this queue, and routes it to the endpoint controllers via a feature within NestJS called MessagePattern
. This forwards anything listening on this message pattern to the endpoint / controller in question.
In order for this to work, messages must be supplied to the queue NestJS is listening to in the following format:
{
"pattern": "instanceDeath",
"data": {
"foo": "bar"
}
}
Here, any endpoint / function with @EventPattern('instanceDeath')
will consume the message and process it.