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

How to test Akka Persistence actor

I'm working on a project that's based on Akka Persistent FSM. In particular: I want to know what the best way is to structure test cases for independence? Since state changes are persisted (this is not well explained in the documentation, but can…
acjay
  • 34,571
  • 6
  • 57
  • 100
5
votes
3 answers

Can I use akka persistence when the actor state is only increase in size?

I'm playing with akka persistence trying to implement a service where my state is a potentially very big (well let's say it won't fit in RAM) list of some entities. Lets say user want all history on all entities to be available. Can I do that in…
user1685095
  • 5,787
  • 9
  • 51
  • 100
5
votes
1 answer

Proper way to inject dependencies into clustered persistent Akka actors?

I'm using Akka Persistence with Cluster Sharding. What is the proper way to provide dependencies into such PersistentActor-s? As far as I understand, passing them as constructor arguments is not possible, as Cluster Sharding is creating these…
John M
  • 1,469
  • 17
  • 41
5
votes
1 answer

How to merely stop child actors upon a parent's restart?

I have an Akka parent actor with several children. When the parent actor is restarted, I need it to simply stop its children, rather than stopping and re-creating or restarting them. (A child would be created manually later, if it's needed.) Is…
Lasf
  • 2,536
  • 1
  • 16
  • 35
4
votes
1 answer

Cassandra datastax gives error "All host(s) tried for query failed"

Today I encountered an issue while connecting to cassandra using datastax. I am got the error "All host(s) tried for query failed". Eventually I figured out that it was due to SSL termination the connectivity was not happening. Question: I…
Varad
  • 920
  • 10
  • 25
4
votes
1 answer

Find actor by persistence id

I have a system, that has an actor per user. Users send messages rarely, but when they do, they send usually not only one, but few. Currently, I have a map, where I store persistenceId -> ActorRef. When I'm receiving a new message for an actor, I…
psisoyev
  • 2,118
  • 1
  • 25
  • 35
4
votes
2 answers

What is the difference between Akka Persistence and Akka Persistence Query?

Akka persistence query complements Persistence by providing a universal asynchronous stream based query interface that various journal plugins can implement in order to expose their query capabilities. This is the description of 'Akka Persistence…
znkomurcu
  • 41
  • 5
4
votes
1 answer

Akka persistence: deleting "old" messages in journal

Cleaning old snapshots in the snapshot store is easy: After each successful snapshot, the actor receives a saveSnapshotSuccess with the meta-data indicating its sequence number, this information can be used to construct a snapshot…
Maths noob
  • 1,684
  • 20
  • 42
4
votes
1 answer

How to use other application.conf in tests than in prod code?

im trying to test PersistentActor with scalatest but I dont know how to point test code to use something like application-test.conf instead application.conf ( I want to change leveldb store for events to in memory store ). Is there any convenient…
hi_my_name_is
  • 4,894
  • 3
  • 34
  • 50
4
votes
1 answer

Which actors should be made Persistent?

Let's imagine a typical Akka application with a tree like structure of Actors i.e. a small (2-3) number of top level actors which manage potentially thousands of small actors at the bottom of the hierarchy. It seems there are two approaches to…
tonicsoft
  • 1,736
  • 9
  • 22
4
votes
1 answer

Akka Persistence: migrating from jdbc (postgres) to cassandra

I have a running project with using of akka-persistence-jdbc plugin and postgresql as a backend. Now I want to migrate to akka-persistence-cassandra. But how can I convert the existing events (more than 4GB size in postgres) to cassandra? Should I…
hich9n
  • 1,578
  • 2
  • 15
  • 32
4
votes
1 answer

CQRS command validation that requires a DB call

In CQRS, What is the best way to validate commands that require DB call? For example, I have Order aggregate that is validating a command say CommitOrder and I don't want to accept this command unless there is enough stock. In this case, how can…
Mutaz
  • 547
  • 4
  • 12
4
votes
1 answer

Understanding AKKA persistence and ES and CQRS principles

I have recently watched several videos about ES and CQRS models as well as I have watched few talks about AKKA persistence. I know what they are about but I have issues writing actual code that will execute. I have few questions though. How should…
Haito
  • 2,039
  • 1
  • 24
  • 35
4
votes
2 answers

How to approach the Q in CQRS when doing Event Sourcing with Akka?

Is there a good way of doing CQRS when combined with Event Sourcing? One way I thought about was doing this in the Command handler (of a Persistent Actor) as soon as the Command was turned into an Event and persisted to the event log (these Events…
Cal
  • 734
  • 1
  • 9
  • 25
4
votes
1 answer

How to send response to a Command in CQRS?

I'm implementing a CQRS system with Akka persistence and I'm trying to understand the request response bit of CQRS. There are few answers on SO on how to send response back to client and this article also mentions a few good patterns. But instead of…
user794783
  • 3,619
  • 7
  • 36
  • 58
1
2
3
19 20