How can i launch an application which does below 2 things:
- Expose rest endpoint via FastAPI.
- Run a seperate thread infintely (rabbitmq consumer - pika) waiting for request.
Below is the code through which i am launching the fastAPI server. But when i try to run a thread, before execution of below line, it says coroutine was never awaited.
How can both be run parallely?

Maybe this is not the answer you are looking for. There is a library called celery that makes multithreading easy to manage in python.
Check it out: https://docs.celeryproject.org/en/stable/getting-started/introduction.html