Background Jobs from the Play Framework on Heroku

On Heroku and using the Play Framework, is it necessary to configure the background job processor (using Akka / RabbitMQ / etc.) to perform heavy tasks *?

I know that Play offers the ability to perform tasks asynchronously in requests, but would that be enough to avoid the need for a background processing processor? On non-Heroku-deployed stand-alone Play applications, asynchronization functions allow you to do everything in one process, but in Heroku applications it seems that this will not be enough: according to the book "Heroku Professional Programming" (page 254 in the section "Developing with Ruby"), web -dyno is blocked between the time the request was received and the response, and all other requests during this time.

If you need a background job processor, are there any examples? I saw examples of Play and Akka, Play and Heroku, but not all three together.

* (For heavy tasks, I usually mean potentially lengthy tasks that need to be answered, for example, the result of a complex database request or a web service call that should be provided to the end user, unlike firefighters and forget things like sending emails).

+3
source share
1 answer

When using Play, you do not need an explicit employee. The general scheme with Play 2 is to use Async response in the controller and Akka for longer processes. All examples on the Play Framework website should work out of the box on Heroku.

+3
source

Source: https://habr.com/ru/post/984482/


All Articles