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
3
votes
1 answer

How to copy an Akka Persistence Cassandra database

We have a Lagom-based project with several microservices, each one (of course) with its own Cassandra keyspace. We need to copy the production data to our qa and dev environments. In a traditional database we would simply export all of the…
Mario Camou
  • 2,303
  • 16
  • 28
3
votes
2 answers

Akka: How to get Children actor on Restart

When the System is restarted, the context.children() call returns zero children for a particular parent. Before restart, context.children() returned the actual count of children that parent had. Can someone please let me know how can we get the…
achin
  • 169
  • 8
3
votes
0 answers

Akka-Persistence database vs actor existence

Assuming I have an actor system (Parent/Child/GrandChild) and am using Akka-Persistence. If I want a user to be able to query an endpoint to read information about an actor e.g. GET /{parent-id}/{child-id}/{grandchild-id} if the parent does not…
Ben Flowers
  • 1,434
  • 7
  • 21
  • 49
3
votes
1 answer

Akka delete persistent message(s)

I'm writing an application to handle events raised by equipments (1million per hour). Some events will be aggregated (and have a long time span (e.g. 48 hours)) containing a begin event, status(x-times)-events and end-event. Others are single event…
motormuis
  • 37
  • 5
3
votes
0 answers

Slick+HikariCP runs out of connections during extensive streaming usage

I am using akka-persistence-jdbc plugin for Akka Persistence in some parts of application and slick directly in another parts. After migrating the the hottest parts from direct slick usage to akka-persistence HikariCP started to throw exceptions:…
Andrey Kuznetsov
  • 11,640
  • 9
  • 47
  • 70
3
votes
1 answer

How can I reload akka scheduler when Play framework restart

I'm currently developing an application using Play-Scala framework and akka actor to send email when a CRUD action with database happen. I have a problem when restart server. Any way to reload akka scheduler when Play framework restart or persist…
viennv1709
  • 43
  • 3
3
votes
2 answers

Implementing a "live" stream to drive an Akka 2.4 Persistence Query

I have been investigating the experimental Akka Persistence Query module and am very interested in implementing a custom read journal for my application. The documentation describes two main flavors of queries, ones that return current state of the…
simonl
  • 1,240
  • 7
  • 19
3
votes
1 answer

Is akka persistance better than me storing a messages status in redis?

I currently like using redis with akka because I can then monitor what messages have been processed just by querying redis. Redis also persists to disk. How does akka persistance compare to just using redis?
cool breeze
  • 4,461
  • 5
  • 38
  • 67
3
votes
1 answer

Update actor state only after all events are persisted

In the receive method of a persistent actor, I receive a bunch a events I want to persist, and only after all events are persisted, update again my state. How can I do that? def receive: Receive = { ... case NewEvents(events) => …
Dimitri
  • 1,786
  • 14
  • 22
3
votes
1 answer

Overcoming changes to persistent message classes in Akka Persistence

Let's say I start out with a Akka Persistence system like this: case class MyMessage(x: Int) class MyProcessor extends Processor { def receive = { case Persistent(m @ MyMessage) => m.x //... } } And then someday I change it to…
Lasf
  • 2,536
  • 1
  • 16
  • 35
3
votes
1 answer

Akka Persistence – Force replay

My application needs to log all messages processed by an actor and replay messages between minSequenceNr and maxSequenceNr sometimes. Is akka-persistence a good for this use case? If yes, How can I force replay messages from journal? I can use…
Andrey Kuznetsov
  • 11,640
  • 9
  • 47
  • 70
3
votes
1 answer

Domain events causal dependency with Event Sourcing and CQRS

Let's say we have a write model (domain) that generates two events: CarrierAdded(...) BusConnectionCreated(carrier, ...) Carrier and BusConnection classes are (part of) separate aggregates. BusConnection is assigned to a Carrier and contains its…
3
votes
1 answer

Akka persistence NotSerializableException for Enumeration

I'm trying to use akkas persistance module(2.3.0), unfortunately when I'm sending Persistent message containing Enumeration I'm getting java.io.NotSerializableException. Here's my earthy example: object TestEnum extends Enumeration with…
user2963977
  • 572
  • 5
  • 17
2
votes
1 answer

Akka-Persistence -Is it ok to use mutable states with akka PersistentActor?

Is it ok to use mutable states with akka PersistentActor or shall I use context.become/unbecome with receiveCommand() and not with the receiveRecover() as it will wait for the full recovery before the state is changed.
2
votes
1 answer

Why use Actors between http server and database

I was following an app example from RockTheJVM (Daniel Ciocîrlan): https://blog.rockthejvm.com/akka-cassandra-project/ For implementing API Rest it uses Akka Http. To access Cassandra it uses Doobie. When a request wants to create a bank account the…
M.G.
  • 369
  • 1
  • 14