- Python >= 3.11
- Poetry package manager
- Redis instance up and running
- Curl or any http client
- Add the
.env
file and install dependencies
poetry config virtualenvs.in-project = true
poetry install
- Activate virtual env for python
poetry shell
- See the scripts available at
pyproject.toml
file - Check redis instance up and use a redis cli or gui
- If you want deactivate venv python run
deactivate
- Run the producer script, then view data in redis
poe start_msg_pub
- Finally run the consumer script
poe start_msg_sub
- Run the fastapi server,
poe dev
then run the request, where 5 and 8 are the input values
curl -X POST localhost:8000/job -H "Content-Type: application/json" -d '{"lowest": 5, "highest": 8}'
- Finally run the consumer script
poe start_num_sub
NOTE:
You can change the amount of test data in src/producer/msg.py
, where 30
is amount and 1
the delay in seconds
if __name__ == "__main__":
main(10, 1)