I created a jar file of my Akka application. When I run the jar file by the command java -jar file.jar then I see this error. What could be possibly wrong and how can I fix this? Answer This kind of error happens when the application is unable to found the reference.conf configuration file in the classpath. M…
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 https://doc.akka.io/docs/alpakka-kafka/current/consumer.html#config-inheritance Ive defined the following : In application.conf I define : But receive error when I startup the Akka Clu…
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: ht…
How to create a custom Uniform Fan Out Shape in Akka through the Java library
So I am building an Akka custom component to learn the framework. I need to create a UnifromFanOut shape custom component. So I tried to extend the shape but the issue is how do I create the shape with 1 input and 3 outputs. The class requires a seq object which is a part of Scala but I am a
Calcualte average using Akka Streams
Using this guide : https://doc.akka.io/docs/akka/current/stream/operators/Source-or-Flow/splitAfter.html 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…
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…
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 : https://doc.akka.io/docs/akka/current/stream/stream-flows-and-basics.html The fold operation seems to cause nothing to outputted on the console. However if I use instead of Then the …
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 (https://doc.akka.io/docs/akka/current/cluster-usage.html) 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…
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 ret…
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 …