Simulates sending a large number of SMS alerts, like for an emergency alert service.
- Install RabbitMQ or use the docker image, documentation found here.
- Clone this repo locally
- cd in
sms-sim/src
and runpip install .
- Start RabbitMQ server, by default the sms-sim package assumes it's running on localhost on port 5672
- Start the streamlit app by running
streamlit run streamlit_gui.py
in thesms-sim/src
directory - A browser window should pop up with the streamlit app. If not, navigate to http://localhost:8501 in your browser.
- All fields have sensible defaults to enable you to easily click the "Start Simulation" button.
- The "Sent Messages", "Failed Messages" and "Average Time per Message (ms)" fields will begin to update based on the "Monitoring Interval" field.
- When the sim is done, a results table will be display below showing metadata for every message sent.
- The logs will save into your home directory under
sms-sim_logs/<Simulation Name>/<timestamp>/
- Repeat until you are tired of simulating SMS messages ;)
- Messages are randomly generated and sent to a RabbitMQ queue.
- Workers on separate processes consume messages and simulate sending the message.
- Messages fail sending based on the "Failure Rate" field, and can either be retried or discarded.
- Workers push the results of the message attempt to either a "passed" or "failed" queue, and also push their delay times to third queue.
- During the sleep interval, the main thread consumes the delay times and calculates a running average delay time for the GUI.
- When the simulation is over the results in both "passed" and "failed" queues are combined into a pandas dataframe and displayed in the GUI.
- Each consecutive run will clear the queues before starting, also generating a new set of logs.