This micro-service acts as example for creating all the new micro-services for TDEI project in Python. The reference code can be used in other micro-services.
This template has the following
-
config.py This file is used to maintain all the configurations required for running the application.
-
processing_service.py This file and the classes within are used to interact with the service bus messages (incoming and outgoing)
-
storage_service.py This file and the classes within are used to interact with the remote file storage.
python 3.10
python3.10 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
PROVIDER=Azure
QUEUECONNECTION=Endpoint=sb://xxxxxxxxxxxxx
STORAGECONNECTION=DefaultEndpointsProtocol=https;xxxxxxxxxxxxx
Note: Replace the endpoints with the actual endpoints
Change the following parameters in config.py
incoming_topic: str = 'incoming-topic' # Change this
incoming_topic_subscription: str = 'incoming-sub' # Change this
outgoing_topic: str = 'outgoing-topic' # Change thisuvicorn src.main:app --reload
Create a virtual env using Anaconda, see here https://docs.anaconda.com/navigator/tutorials/manage-environments/
Go to project location and activate the conda environment
pip install -r requirements.txt
Run the below commands to setup the environment variables
export PROVIDER="Azure"
export QUEUECONNECTION="Endpoint=sb://xxxxxxxxxxxxx"
export STORAGECONNECTION="DefaultEndpointsProtocol=https;xxxxxxxxxxxxx"
Note: Replace the endpoints with the actual endpoints
uvicorn src.main:app --reload