I have a python project that consumes messages from an AWS SQS queue and performs tasks. It does this by constantly trying to get messages from the queue in an infinite loop and performing operations on each message when they’re found.

I’d like to deploy this code in a docker container and would like to integrate a health check to ensure certain things are working.

I am trying to understand what the best way is to integrate a light weight webserver alongside the infinite loop to serve a /health-check endpoint.

I have looked popular libraries like flask/fastapi, however it seems like they both block the main thread, requiring the worker to run in its own thread. This seems to introduce further complexity by having to also handle thread errors/sigints and possibly other thread<>thread messages.

Is there a simpler way to introduce a health check?

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *