Skip to content

Commit e9c202c

Browse files
authored
feat: new query api for listing persistence id per entity type (#32793)
* feat: new query api for listing persistence id per entity type * headers/formattin
1 parent 07edb02 commit e9c202c

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (C) 2009-2025 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package akka.persistence.query.typed.javadsl
6+
7+
import akka.NotUsed
8+
import akka.stream.javadsl.Source
9+
10+
import java.util.Optional
11+
12+
/**
13+
* A plugin may optionally support this query by implementing this trait.
14+
*/
15+
trait CurrentPersistenceIdsForEntityTypeQuery {
16+
17+
/**
18+
* Get the current persistence ids for a given entity type.
19+
*
20+
* The persistenceIds must start with the entity type followed by default separator ("|") from
21+
* [[akka.persistence.typed.PersistenceId]].
22+
*
23+
* @param entityType
24+
* The entity type name.
25+
* @param afterId
26+
* The ID to start returning results from, or empty to return all ids. This should be an id returned from a previous
27+
* invocation of this command. Callers should not assume that ids are returned in sorted order.
28+
* @param limit
29+
* The maximum results to return. Use Long.MAX_VALUE to return all results. Must be greater than zero.
30+
* @return
31+
* A source containing all the persistence ids, limited as specified.
32+
*/
33+
def currentPersistenceIds(entityType: String, afterId: Optional[String], limit: Long): Source[String, NotUsed]
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (C) 2009-2025 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package akka.persistence.query.typed.scaladsl
6+
7+
import akka.NotUsed
8+
import akka.stream.scaladsl.Source
9+
10+
/**
11+
* A plugin may optionally support this query by implementing this trait.
12+
*/
13+
trait CurrentPersistenceIdsForEntityTypeQuery {
14+
15+
/**
16+
* Get the current persistence ids for a given entity type.
17+
*
18+
* The persistenceIds must start with the entity type followed by default separator ("|") from
19+
* [[akka.persistence.typed.PersistenceId]].
20+
*
21+
* @param entityType
22+
* The entity type name.
23+
* @param afterId
24+
* The ID to start returning results from, or empty to return all ids. This should be an id returned from a previous
25+
* invocation of this command. Callers should not assume that ids are returned in sorted order.
26+
* @param limit
27+
* The maximum results to return. Use Long.MAX_VALUE to return all results. Must be greater than zero.
28+
* @return
29+
* A source containing all the persistence ids, limited as specified.
30+
*/
31+
def currentPersistenceIds(entityType: String, afterId: Option[String], limit: Long): Source[String, NotUsed]
32+
}

0 commit comments

Comments
 (0)