I am building an asynchronous web server using Fla...
# ktor
k
I am building an asynchronous web server using Flask and Celery. The latter is a task queue manager. In the screenshot below, I generate a task ID via a POST request to the web server and the actual task starts 10 seconds later. You can then check the status via an automated task id generated by Celery. I prefer coding with Ktor for obvious reasons but I am struggling to find out a way to do the same thing easily. Does anyone know how to address that? (asynchronous tasks triggered by a post and status easy to assess). I don’t mind adding external components (but not too complex ones 🙂 )
c
Ktor doesn’t have any official queue/background job support. You could probably look for queue libraries used in Spring or other Java server frameworks, or directly use something like AWS SQS for robust queues. Alternatively, for a simpler, “unmamaged” approach, you can directly kick off an
async { }
task from a ktor route handler, to run the task purely in memory (definitely not a recommended approach if you need to query for status, handle errors/retries, etc.)
k
Thank you @Casey Brooks! Indeed, when you think about it, the real power of the combination Flask+Redis+Celery is that it is so simple to install, it feels like it almost look like one product. It is just like it seems there were no similar combination in the Kotlin/Ktor world, even Java.. That's why I tried my chance here. I'll give a look at SQS and others feom Spring.
c
Alpas (https://alpas.dev/) is a different framework option that seems to be much more “batteries included” than Ktor. I haven’t tried it personally, but it does look pretty nice, and includes queues
k
🤩 Indeed it seems shiny !! I’ll give it a try soon.