CassandraReadJournal cannot get events by persistence id
See original GitHub issueLagom Version (1.2.x / 1.3.x / etc)
1.3.9
API (Scala / Java / Neither / Both)
Scala
Expected Behavior
- Persist event
A
with PersistentEntity whosepersistenceId
isX
- Create a cassandra read journal
readJournal
:
private val readJournal =
PersistenceQuery(actorSystem).readJournalFor[CassandraReadJournal](CassandraReadJournal.Identifier)
- get all current events in that read journal by persistenceId
X
val events = readJournal
.currentEventsByPersistenceId(X, 0, Long.MaxValue)
.runWith(Sink.seq[Any])
- yield a sequence containing
A
Actual Behavior
events
is always empty
Reason
<del> When `currentEventsByPersistenceId` issues a query, the underlying query is:SELECT tag1, timebucket, timestamp, persistence_id, partition_nr, sequence_nr, writer_uuid, ser_id, ser_manifest, event_manifest, event, message
FROM whatever_keyspace.messages
WHERE persistence_id IS NOT NULL AND partition_nr IS NOT NULL AND sequence_nr IS NOT NULL
AND tag1 IS NOT NULL AND timestamp IS NOT NULL AND timebucket IS NOT NULL
PRIMARY KEY ((tag1, timebucket), time... [truncated output]
However, Lagom’s persistence does not persist tag1
, tag2
, tag3
, or message
. Therefore, the resultant select
yields an empty list.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Unable to get events by tags - Persistence / Event Sourcing
I am unable to get events by tags, I am using akka 2.5.23, akka-persistence-cassandra 0.98, and Cassandra 3.6 This is part of my...
Read more >Query Plugin • Akka Persistence Cassandra - Documentation
A Cassandra plugin for Akka Persistence. ... Persistence Query usage example to obtain a stream with all events tagged with ... Identifier) queries....
Read more >Events are not recovering in Akka 2.4.0 Persistence ...
So, take the default cassandra-journal config and override the keyspace . Then, like you're doing, overriding persistenceId in the Akka ...
Read more >Akka persistence - Beyond the lines
It's possible to query the metadata (persistence id, timestamps, ... However we get only the events of a single actor (because of the...
Read more >akka.persistence.query.PersistenceQuery Scala Example
toString } // provides a unique persistence-id per test case and some initial persisted events protected trait Setup { lazy val probe =...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ignasi35 For complete closure, I’ll post a notional solution:
Because
entityTypeName
is a class member (not static), I addedentityTypeName
to a companion object to my PersistentEntity, with which I override the PersistentEntity’sentityTypeName
. Then I can access a staticpersistenceId
and futureproof my DB (like the docs mention).And to confirm, the above solution worked. 👍