Skip to content

Tag: akka

How to use ${akka.kafka.consumer}?

I’m attempting to use the default Kafka config settings but I’m unsure how ${akka.kafka.consumer} is set. Reading Ive defined the following : In application.conf I define : But receive error when I startup the Akka Cluster: Is ${akka.kafka.consumer} an environment variable that I need to set externally when starting the Akka Cluster or is ${akka.kafka.consumer} a config variable that

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

CORS issue / akka-http-cors / No ‘Access-Control-Allow-Origin’ header is present on the requested resource in Scala/Java

How do I implement akka-http-cors correctly to be able to allow access from any origin (domain, in my case localhost:3000) to a Https Server (Scala/Akka)? Based on the akka-http-cors documentation should defaultSettings do the job, but I am still doing something wrong: Google Chrome Error: Firefox Error: akka-http-core: Any help is highly appreciated! Answer The problem in my case

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

How to access the computation result of an Akka Stream?

I’m attempting to return the result of a stream operation which in this case is: sum a list square the value square the value which is represented as: To access the value I use followed by : Which requires a blocking call to allow the stream to complete which is not acceptable: If I use: an error is returned :

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: I have defined the code below to try to achieve this result: Sending data to the stream using : actorRef.tell(Arrays.asList(1,2,3), ActorRef.noSender()); does not appear to have any impact as the result of executing the above code is: Have I implemented the