View Concepts
This section covers the key concepts that underpin Akka Views, explaining how they work and how to use them effectively in your applications.
Core Concepts
Data Structure and Access
-
Table Updaters - The fundamental building blocks of Views, defining data sources and table structures
-
Data Types - The supported data types in Views and how they map between Java and the query language
-
Result Mapping - How query results are transformed into Java objects in your application
Specialized Data Handling
-
Optional Fields - Working with values that may or may not be present
-
Array Types - Handling collections of values within a single view row
Advanced Features
-
Advanced Views - Creating sophisticated views with multiple tables, joins, and complex data structures
Understanding Views
Views in Akka provide a flexible way to access your data using patterns beyond simple key-based lookups. They create queryable projections of your entities that can be optimized for specific access patterns.
How Views Work
-
Data Consumption: Views subscribe to events or state changes from entities or topics
-
Transformation: These events/changes are transformed into rows in view tables
-
Indexing: Views automatically create indexes based on your queries
-
Querying: The view query language allows you to retrieve and filter this data
View Benefits
-
Flexible Access Patterns: Access data by any field, not just entity IDs
-
Optimized Queries: Views create indexes for efficient querying based on your needs
-
Joined Data: Combine data from multiple entities into unified query results
-
Custom Projections: Transform entity data into formats optimized for reading
View Characteristics
-
Eventually Consistent: Views are eventually consistent with their source entities
-
Read Optimized: Views are designed for efficient reading, not for updates
-
Declarative Definition: Views are defined by their queries and transformations
-
Automatic Maintenance: Updates to views happen automatically as entities change
From Entity to View
Understanding the relationship between entities and views is key to effective modeling:
Entity Focus vs. View Focus
-
Entities: Focus on business logic, command handling, and state consistency
-
Views: Focus on data access patterns, querying, and read optimizations
Related Documentation
-
View Query Syntax - Complete reference for the View query language
-
Implementing Views - How to implement Views in your application