Skip to content

Tag: akka

Timed behaviors in Akka classic?

I am working with Akka classic, and have to setup timed behaviors – in Akka typed, I could do this using Behaviors.withTimers how do I accomplish this in Akka classic? It seems like we can create an actor in Akka using How do I use timers in this kind of initialization? Answer See the docs on Timers: In short,

Calcualte average using Akka Streams

Using this guide : I’m attempting to calculate the average of a number of attributes within a List. More specifically, using the code below I’m attempting to calculate the average value for a an actor source that emits values within a specified time frame : The closest I’ve got is just summing the values using reduce : How to

fold not working as expected using akka streams

Below is code I’ve written to try an output the sum of each akka message received which has been edited from this guide : The fold operation seems to cause nothing to outputted on the console. However if I use instead of Then the following is outputted : I’m attempting to group a list and perform a fold operation

How to specify role at node level within Akka cluster?

Given the following appliction.conf : To discern between the roles within an Actor I use : edited from src ( To enable role for a node I use the following config : Within application.conf I configure the array for the roles but this appears to be at the cluster level rather than node level. In other words it does not

Sending data to an Akka Stream

I’m attempting to send an ArrayList to an Akka stream for processing. The stream processes the list as follows: 1. Sum the list 2. Square the result of the sum. I have defined the code below to try …