An actor model gives us outstanding solution for building of high scale and high load systems. Those of you who work with Akka, know that in the Actor model everything should be represented as an actor. In some sense this axioma simplifies a software development. Is this circumstance as good as it seems? In this article I'm going to demonstrate some approaches which may be applied to actors which need to interact with a database. Just imagine, what sense in a high scale and high load system if it does not communicate with a database?
The question is how to validate a HTTP request body using Akka HTTP directive? Of course we can use for this reason
validate directive, but it has one drawback which I described in my previous post about a model validation in Akka HTTP. You may want to use
require method, but it is not so functional as well. Today I want to show another way for validation of HTTP request body in Akka.
If you work with Akka HTTP for a while, you should definitely know that it has multiple ways for model validation. I talk about http request body validation. Probably in 99% of cases you would like to ensure that user send something meaningful to the server. So exactly for this purpose Akka HTTP provides validation mechanisms. But what if you want to send back to the client side information about all invalid fields?
How a newcomer can understand Akka's principles of work? Couple of examples from the documentation could be not enough. From the other side, a simple application which shows Akka in action is a very good way for demonstration of Actors capabilities. So let's start the acquaintance with the simple Akka use case!
How we can build a close interaction between Actors? Just with help of messaging. In the previous post I've already demonstrated how we can send messages between Actors. In this post I want to continue topic of message exchange, but this time let's develop cooperation of two Actors which interact with each other.