GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ShahOdin/QueryView: lightweight PersistentView implementation with PersistenceQuery

BranchesTags
Open more actions menu

Latest commit

 

History

143 Commits
143 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
README.md
README.md
 
 
build.sbt
build.sbt
 
 

Repository files navigation

QueryView

PersistentView used to be a construct offered in Akka replicating the persistent message stream of a PersistentActor. Implementation classes received the message stream directly from the Journal. These messages could be processed to update internal state in order to maintain an (eventual consistent) view of the state of the corresponding persistent actor. It is now deprecated in Akka 2.5.

QueryView is a lightweight implementation of PersistentView based on the stream API, which snapshots its local cache of the data it builds up from the events related to PersistentActor of interest. it does not persist its data and relies only on regular snapshotting of the data it reads.

QueryView snapshots the cached data itself and caches the offsets as persisted events. Note that a given QueryView does not have to cache the full set of data it reads from a persistent Actor and can pick and choose the data it caches internally.

The basis of using PersistenceQuery can be seen in QueryInspector which creates a stream of events from a PersistentActor and will receive all the following events from that actor in its inbox. That would be the starting point to look at. AccountInspectApp demonstrates this.

AccountQueryApp fires up a persistent actor as well as a reader actor. The reader receives not only the events from the write actor after the reader was created, but also the past events. the reader receives the persisted events from write actor's journal and updates its cache and responds to read queries based on its cache of the data at the time. the result will be "eventually consistent" after the reader's cache of data is in sync with the write side.

Note that since the view actor is itself a persistent actor and persists and snapshots its own data, using the queryView needs slight considerations if there are going to be multiple copies of it in different nodes. Easiest solution would be to have it as a cluster singleton. Better solution would be to set its persistence Id configurable based on a constructor parameter. This way there will not be any mix-up with the persisted messages/snapshots.

About

lightweight PersistentView implementation with PersistenceQuery

Topics

akkaeventually-consistentpersistencepersistent-messagespersistent-queuestream

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.