user2066049
user2066049

Reputation: 1371

akka persistence or not

Current application uses Akka eventstream and its publish/subscribe for a use case which imports a lot of data and upon receiving data for each row it publishes and event and there is an subscriber to it. this design is running into risk of losing events if something goes wrong with either publisher/subscriber as such.

I am wondering if using Akka persistence makes sense here, for a few reasons

1)Persist events 2)Audit history 3)Recreate scenario with snapshot

note there isn't a shared/global state (generally described as a use case in almost all Akka persistence blogs/examples) in the system.

Does Akka persistence make sense here?

Upvotes: 1

Views: 396

Answers (1)

Diego Martinoia
Diego Martinoia

Reputation: 4662

If I understand your scenario correctly, I'd say no for 1), yes for 2), no for 3):

1) If the message is lost due to a problem with the pub/sub mediator (which you don't really control), it will never reach your persistent actors and therefore will never be saved in the event stream, thus never replayed.

2) Recorded message will be lookable upon during audit.

3) If your actors are stateless processors, what scenario are you going to recreate/save in the snapshot?

I'd suggest you can work around 1 by using a confirmation/retry mechanism in which you resend the message at regular intervals until you receive an ack from the consumer.

Upvotes: 0

Related Questions