Reputation: 2173
I am currently building an event sourced application with Akka Persistence and the Cassandra Journal Plugin. I have some views, which need to capture events of multiple persistence ids, therefore I am using the eventsByTag queries to update (e.g.) my mongodb views.
If I restart my application, the query gets replayed, so I need to somehow store the state of the views, so it does not replay events, which have already been processed.
At first I planned on using the offset of the last processed event, since the Cassandra Plugin uses TimeUUID internally and it should be unique. The problem here is, that Akka Journal only supports Long values as offset so the TimeUUID gets converted back to a normal timestamp.
So e.g.:
2d2504b1-31f8-11e6-af83-9f34c8060f40 and 2d2504b2-31f8-11e6-af83-9f34c8060f40
both result in the same offset, which makes it useless for me in terms of determining the last processed event, if I have multiple events within the same ms.
Does anyone have an idea on how to approach this in a better way?
EDIT
The CassandraReadJournal
provides an overloaded version of the getEventsByTag stream, which returns UUIDEventEnvelopes. This contains the offset as UUID and not Long.
Upvotes: 1
Views: 628
Reputation: 2173
The CassandraReadJournal
provides an overloaded version of the getEventsByTag
stream, which returns UUIDEventEnvelopes
. This contains the offset as UUID
and not Long
and is therefore unique.
Upvotes: 1