Questions tagged [akka-persistence]

Akka persistence enables stateful actors to persist their internal state so that it can be recovered when an actor is started, restarted after a JVM crash or by a supervisor, or migrated in a cluster.

Akka persistence enables stateful actors to persist their internal state so that it can be recovered when an actor is started, restarted after a JVM crash or by a supervisor, or migrated in a cluster.

The key concept behind Akka persistence is that only changes to an actor's internal state are persisted but never its current state directly (except for optional snapshots). These changes are only ever appended to storage, nothing is ever mutated, which allows for very high transaction rates and efficient replication. Stateful actors are recovered by replaying stored changes to these actors from which they can rebuild internal state. This can be either the full history of changes or starting from a snapshot which can dramatically reduce recovery times. Akka persistence also provides point-to-point communication channels with at-least-once message delivery semantics.

Source: http://doc.akka.io/docs/akka/snapshot/scala/persistence.html

297 questions
0
votes
0 answers

AKKA persistent actor doesn't receive command messages in the receive command function

I am trying to use AKKA persistence together with the JDBC plugin. However, when experimenting with the persistent actors I face the problem that my persistent actor does not receive the messages it should receive. Here is my application.conf file I…
Dirac
  • 25
  • 5
0
votes
1 answer

Akka Cluster Scheduler - what happens when a node goes down

I want to have a scheduler in my cluster that would send some messages after some time. From what I see scheduler is per actorsystem, from my tests only for local actor system. Not the cluster one. So If schedule something on one node, if it get's…
jtyb
  • 43
  • 5
0
votes
1 answer

Java serialization disabled for EventSourcedBehaviorTestKit

I am trying out EventSourcedBehaviorTestKit using documentation as a guidance. I used following configuration ScalaTestWithActorTestKit(EventSourcedBehaviorTestKit.config) which uses DisableJavaSerializer due to akka.actor.allow-java-serialization =…
user_1357
  • 7,766
  • 13
  • 63
  • 106
0
votes
1 answer

Create TestProbe of an child actor from a name

Using akka typed: 2.6.10. My parent generates child actors to do some work as you can see below (note this is part of event sourced actor). Is there a way to acquire reference to internally created child actor using possibly name during testing…
user_1357
  • 7,766
  • 13
  • 63
  • 106
0
votes
1 answer

Akka Persistence: No Sufficient Working Example for JDBC MySQL

I have been trying to get my EventSourceBehavior to write to MySQL and am getting following error, what could be the issue? Error is very generic and it is hard to see what is the root cause. Is there a way to test wether my JDBC is correctly…
user_1357
  • 7,766
  • 13
  • 63
  • 106
0
votes
1 answer

Batch operations with akka persistance, what options are there?

Say I am using akka persistance and I am backing things like Users. If there is a nighly job that requires scanning all users, and any user that has expired to mark their object as expired. In a more traditional setup using sql, you would just…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
0
votes
1 answer

Using an actor with persistence for a shopping cart so every visitor will have their own actor

If I have an actor to represent a shopping cart: class ShoppingCartActor extends PersistentActor with ActorLogging { override def persistenceId: String = "shopping-cart-actor" override def receiveCommand: Receive = ??? override def…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
0
votes
3 answers

Would storing a rich object as an actor with persistance be a good idea?

If you are familiar with Trello, would storing an entire Trello board as an actor (with akka persistence) be a good use case? A trello board consists of: lists tasks in a list each task can have comments and other properties What are the general…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
0
votes
1 answer

Safe persistenceId encoder for complex primary key

What is the best way to generate persistenceId from complex key (String, String) and every part of this key is not controlled (may contain any symbol)? If decoding is required If decoding is not required (original key stored in actor)
andrey.ladniy
  • 1,664
  • 1
  • 11
  • 27
0
votes
1 answer

Insert events to get desired state before running behaviour tests

I am trying to insert events before I try to execute some commands. I want to get my behaviour in a state ready for particular test, without needing to rerun all the commands, like database fixtures in regular testing. I am…
kunicmarko20
  • 2,095
  • 2
  • 15
  • 25
0
votes
0 answers

Execute a side effect after an event has been persisted

I am trying to find the best way to execute async side effect (or some action) after an event has been persisted. Here is what I am doing right now, and would appreciate if someone could tell me if there is a better way. Example 1: Actor A does…
kunicmarko20
  • 2,095
  • 2
  • 15
  • 25
0
votes
0 answers

persistence of akka messages for routers

How do we handle persistence in case we are using akka routers. We would want to persist the unprocessed messages in the mailbox and be able to process them in case of server crashes and restarts. i know classic dispatchers provide filebasedmailbox…
0
votes
1 answer

Akka Cluster Sharding - can different entities within the cluster communicate with each other?

All materials on Cluster Sharding with Akka imply sending messages from outside the cluster to entities in the cluster. However, can entities (actors) in different sharding regions/shards of the same cluster communicate between each other? Is there…
AndCode
  • 384
  • 1
  • 10
0
votes
0 answers

Scala / Akka: How actor keeps the command and changes the behavior to execute it

I would like to stash the received message and migrate the data after the success of the migration I change the behavior to execute the stashed command. trait Actor { this: Stash with Actor => def executeCommands: Receive = { case "OK" =>…
kaio
  • 131
  • 1
  • 10
0
votes
1 answer

why persist method never works?

i have working with persistenceActor but when i call persist() method the callback never reaches i can't find any errors in terminal actor Code class MajorEventActor extends Timers with PersistentActor with ActorLogging{ var currentSeqNr =…
user9116815
  • 23
  • 1
  • 10