{"id":37019932,"url":"https://github.com/firstbirdtech/akka-persistence-query-view","last_synced_at":"2026-01-14T02:14:03.887Z","repository":{"id":40328190,"uuid":"130214528","full_name":"firstbirdtech/akka-persistence-query-view","owner":"firstbirdtech","description":"Akka PersistentView drop in replacement","archived":false,"fork":true,"pushed_at":"2025-01-07T12:34:06.000Z","size":171,"stargazers_count":0,"open_issues_count":17,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-02T15:15:41.148Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"danischroeter/akka-persistence-query-view","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firstbirdtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-04-19T12:47:11.000Z","updated_at":"2022-12-23T10:30:06.000Z","dependencies_parsed_at":"2023-02-12T11:01:21.344Z","dependency_job_id":"c268f00a-e434-4934-a27c-7a54820b0f1a","html_url":"https://github.com/firstbirdtech/akka-persistence-query-view","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/firstbirdtech/akka-persistence-query-view","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbirdtech%2Fakka-persistence-query-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbirdtech%2Fakka-persistence-query-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbirdtech%2Fakka-persistence-query-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbirdtech%2Fakka-persistence-query-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstbirdtech","download_url":"https://codeload.github.com/firstbirdtech/akka-persistence-query-view/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbirdtech%2Fakka-persistence-query-view/sbom","scorecard":{"id":401203,"data":{"date":"2025-08-11","repo":{"name":"github.com/firstbirdtech/akka-persistence-query-view","commit":"1a8bff4ec316e97f6f9b9450e9f2915b011125f9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/release-drafter.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-drafter.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/firstbirdtech/akka-persistence-query-view/release-drafter.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T20:07:59.618Z","repository_id":40328190,"created_at":"2025-08-18T20:07:59.618Z","updated_at":"2025-08-18T20:07:59.618Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T02:14:03.165Z","updated_at":"2026-01-14T02:14:03.873Z","avatar_url":"https://github.com/firstbirdtech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a fork of [danischroeter/akka-persistence-query-view](https://github.com/danischroeter/akka-persistence-query-view) which uses akka version 2.5.x instead of 2.4.x.\n\n# Persistence query view\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.firstbird/akka-persistence-query-view_2.13.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.firstbird%22%20AND%20a:%22akka-persistence-query-view_2.13%22)\n[![Github Actions CI Workflow](https://github.com/firstbirdtech/akka-persistence-query-view/workflows/CI/badge.svg)](https://github.com/firstbirdtech/akka-persistence-query-view/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/firstbirdtech/akka-persistence-query-view/branch/master/graph/badge.svg?token=3WIUBL914B)](https://codecov.io/gh/firstbirdtech/akka-persistence-query-view)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)\n\nThe `QueryView` is a replacement of the deprecated `PersistentView` in Akka Persistence module.\n\n## Anatomy of a Persistence QueryView\n\nThe Persistence query view has three possible state: `WaitingForSnapshot`, `Recovering` and `Live`.\n\nIt always start in `WaitingForSnapshot` state where it is waiting to receive a previously saved snapshot. When the snapshot has been loaded or failed to load, the view switch to the `Recovering` state.\nDuring the `Recovering` state it will receive all the past events from the journal. When all the existing event from the journal have been consumed, the view will switch to the `Live` state which will keep until the actor stop.\nDuring the `Live` events the view will consume live events from the journal and external messages.\n\nWhen the view is in `WaitingForSnapshot` or `Recovering` it will not reply to any messages, but will stash them waiting to switch to the `Live` state where these message will be processed.\n\n## Adding the dependency\n\nAdd a dependency to your `build.sbt`:\n\n```\nlibraryDependencies += \"com.firstbird\" %% \"akka-persistence-query-view\" % \"x.x.x\"\n```\n\n## How to implement\n\nThe first step is to define a `Querysupport` trait for your `ReadJournal` plugin. The LevelDb one is included:\n\n```scala\nimport akka.contrib.persistence.query.QuerySupport\nimport akka.persistence.QueryView\nimport akka.persistence.query.{Offset, PersistenceQuery}\nimport akka.persistence.query.journal.leveldb.scaladsl.LeveldbReadJournal\n\ntrait LevelDbQuerySupport extends QuerySupport { this: QueryView =\u003e\n\n  override type Queries = LeveldbReadJournal\n  override def firstOffset: Offset = Offset.sequence(1L)\n  override val queries: LeveldbReadJournal =\n    PersistenceQuery(context.system).readJournalFor[LeveldbReadJournal](LeveldbReadJournal.Identifier)\n}\n```\n\nIt is up to the implementor defining the queries used during the `Recovering` and `Live` states. Generally they will be the same query, with the difference that the recovery one is a finite stream while the live one is infinite.\nYour `Queryview` implemention has to mix in one `QuerySupport` trait as well:\n\n```scala\nimport akka.stream.scaladsl.Source\n\ncase class Person(name: String, age: Int)\ncase class PersonAdded(person: Person)\ncase class PersonRemoved(person: Person)\n\nclass PersonsQueryView extends QueryView with LevelDbQuerySupport {\n\n  override val snapshotterId: String = \"people\"\n\n  private var people: Set[Person] = Set.empty\n\n  override def recoveringStream(): Source[AnyRef, _] =\n    queries.currentEventsByTag(\"person\", lastOffset)\n\n  override def liveStream(): Source[AnyRef, _] =\n    queries.eventsByTag(\"person\", lastOffset)\n\n  override def receive: Receive = {\n\n    case PersonAdded(person) =\u003e\n      people = people + person\n\n    case PersonRemoved(person) =\u003e\n      people = people - person\n\n  }\n}\n```\n\nThe `WaitingForSnapshot` and `Recovering` states are protected by a timeout, if the view will not be able to rebuild its status within this timeout, it will switch to the `Live` state or crash. This behavior is controlled by the `recovery-timeout-strategy` (TODO) option.\n\nThe `QueryView` has an out-of-the-box support for snapshot. It is the same as the deprecated `PersistentView`, in the previous exaple to save a snapshot of the current people:\n\n```scala\nimport akka.stream.scaladsl.Source\n\ncase class Person(name: String, age: Int)\ncase class PersonAdded(person: Person)\ncase class PersonRemoved(person: Person)\n\nclass PersonsQueryView extends QueryView with LevelDbQuerySupport {\n\n  override val snapshotterId: String = \"people\"\n\n  private var people: Set[Person] = Set.empty\n\n  override def recoveringStream(): Source[AnyRef, _] =\n    queries.currentEventsByTag(\"person\", lastOffset)\n\n  override def liveStream(): Source[AnyRef, _] =\n    queries.eventsByTag(\"person\", lastOffset)\n\n  override def receive: Receive = {\n\n    case PersonAdded(person) =\u003e\n      people = people + person\n      if(noOfEventSinceLastSnapshot() \u003e 100) {\n        saveSnapshot(people)\n      }\n\n    case PersonRemoved(person) =\u003e\n      people = people - person\n      if(noOfEventSinceLastSnapshot() \u003e 100) {\n        saveSnapshot(people)\n      }\n\n  }\n}\n```\n\nUnder the hood it will store also the last consumed offset and the last sequence number for each persistence id already consumed.\n\nThe QueryView checks that all received events follow a strict sequence per persistentId. Be aware that most journal plugins do not guarantee the correct order for `eventsByTag` (see journal documentation).\nIf that is ok one can overwrite `override def allowOutOfOrderEvents = true` to omit the checking. (In the future we might implement some deferred processing of out of order received events)\n\n### Forced Update\n\nMost journals use some sort of polling under the hood to support a live stream for `eventsByTag/eventsByPersistentId` PersistentQueries. (The default cassandra journal uses 3 seconds)\nIn scenarios when a more up to date state is needed one can issue a forced update which will immediately read from the recoveringStream. (Use `forceUpdate()` or send a ForceUpdate).\nThe QueryView ensures forcedUpdate is not performed concurrently so forceUpdate is ignored while it has not completed. After forceUpdate is completed `onForceUpdateCompleted()` is called.\nFor some scenarios it makes sense to retrigger `forceUpdate()` within `onForceUpdateCompleted()` until some condition is met.\n\n## Future developments\n\n-   Add the `recovery-timeout-strategy` option to control what to do when the view does ot recover within a certain amount of time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstbirdtech%2Fakka-persistence-query-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstbirdtech%2Fakka-persistence-query-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstbirdtech%2Fakka-persistence-query-view/lists"}