Search code examples
functional-programmingmicroserviceshttp4k

How does http4k continue computation after response?


Imagine that I have some long running tasks to be executed after getting a Post request, for which I simply respond 200 if the data is valid.

The http4k follows the concept that an application is a function. Does it mean that I can't first send back a response and then continue some long running computation? Should I delegate the job to other actors through some message publishing mechanism?


Solution

  • In order to do this you will need to spawn a (virtual) thread or coroutine using the normal methods.