REST services are quite commonly used in scalable architectures because they are stateless. However, in the practical world, a service is rarely just a CRUD service: for example we could also have some background processing (i.e.: downloading/parsing files, scheduled processed, triggers, etc). In this tutorial we demonstrate how to use an Akka SingletonClusterManager in a… Continue reading Background Processing with Akka Cluster: ClusterSingletonManager
Tag: Akka
How to build a REST API with Akka Http
In previous articles we have discussed how to use Spray to build REST APIs. Since Akka 2.4, Spray is no longer supported and it is replaced by Akka Http. This article will introduce Akka Http, the new shiny toy from the Akka Team, and provide a tutorial on how it can be used to create… Continue reading How to build a REST API with Akka Http
Akka Dead Letters Channel
Akka doesn't guarantee the delivery of a message. What happens when a message cannot be delivered? In this article we will describe how the Dead Letters Channel works and how it can be used to spot issues in our system. How it works In a previous article we have described the use of Event Streams… Continue reading Akka Dead Letters Channel
Peer-to-Many Communication in Akka
The most common communication channel in Akka is Peer-to-Peer, where an individual actor sends a message directly to another individual actor actor. However, sometimes this is not enough as we may need a Peer-to-Many type of communication, where an individual actor sends a message to a group of actors. This is particularly useful when you… Continue reading Peer-to-Many Communication in Akka
How to Integrate ReactiveMongo in your Akka Spray Application
Scalability can be challenging when database access is needed: the common approach is to block the thread until a response is received. ReactiveMongo is a MongoDB Scala Driver that provides fully non-blocking asynchronous I/O operation that increases the scalability of your system. In a previous post we have seen how to build a REST Api… Continue reading How to Integrate ReactiveMongo in your Akka Spray Application
How to Supervise Akka Actors
Supervision is one of the core operations that an Actor can fulfill. Handling errors is not always easy in a classic object oriented programming context as exceptions can be difficult to predict as they are fully embedded in the normal execution flow. In the Akka Actor Model, errors are handled in a well-structured isolated execution… Continue reading How to Supervise Akka Actors
How to test Actors with Akka TestKit and Spec2
Actors are a really powerful tool to handle concurrency thanks to their message-based model. However, they can be tricky to test: sending and processing messages is done asynchronously. Moreover, their status is hidden internally and it cannot be easily accessed to make assertions on it. The Akka Team has created a library, called akka-testkit, to… Continue reading How to test Actors with Akka TestKit and Spec2
How to build a REST api with Spray and Akka
Spray is a library written on top of Akka and Scala that allows to quickly create REST interfaces. It is becoming more and more popular in the Scala community because it is easy to use and performant thanks to this asynchronous, actor-based model. This article describes how to efficiently exploit Spray to create a simple… Continue reading How to build a REST api with Spray and Akka
Akka Actors: Best Practices
Actors are components of message-passing systems that are particularly popular these days. They make concurrency a lot easier to understand compared to the traditional thread-monitor-lock model. An actor is a thread-like program that run independently from other actors. It has a mailbox to receive messages from other actors, where each message represents a task to… Continue reading Akka Actors: Best Practices