1

Suppose I need to a Scala component to process incoming requests concurrently and return the processing results. Suppose also that the request processing consists of a few steps. Some of the steps are resource and time consuming, some of them are either I/O or CPU-bound, etc.

Assuming that requests come from inside the JVM I would design the component as follows:

  • actor "Facade" is the entry point: it receives requests and sends the results to the clients.
  • actor "Dispatcher" execute processing steps asynchronously with Futures, which wrap the steps
  • steps send their results back to the "Dispatcher" actor. It's implemented with Future callbacks.
  • When the request processing finish "Dispatcher" sends the results to "Facade".

Does it make sense? Are there any good examples of such a component in Scala?

1 Answer 1

1

It makes sense given the details you showed.

A good framework for such case would be Akka. See the examples available in the source code, and the many open sourced projects in GitHub.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.