pub struct QueryConfig {Show 13 fields
pub id: String,
pub query: String,
pub query_language: QueryLanguage,
pub middleware: Vec<SourceMiddlewareConfig>,
pub sources: Vec<SourceSubscriptionConfig>,
pub auto_start: bool,
pub joins: Option<Vec<QueryJoinConfig>>,
pub enable_bootstrap: bool,
pub bootstrap_buffer_size: usize,
pub priority_queue_capacity: Option<usize>,
pub dispatch_buffer_capacity: Option<usize>,
pub dispatch_mode: Option<DispatchMode>,
pub storage_backend: Option<StorageBackendRef>,
}Expand description
Configuration for a continuous query
QueryConfig defines a continuous query that processes data changes from sources
and emits incremental result updates. Queries subscribe to one or more sources and
maintain materialized views that update automatically as data changes.
§Query Languages
Queries can be written in either:
- Cypher: Default graph pattern matching language
- GQL: GraphQL-style queries (compiled to Cypher)
Important: ORDER BY, TOP, and LIMIT clauses are not supported in continuous queries as they conflict with incremental result computation.
§Bootstrap Processing
- enableBootstrap: Controls whether the query processes initial data (default: true)
- bootstrapBufferSize: Event buffer size during bootstrap phase (default: 10000)
During bootstrap, events are buffered to maintain ordering while initial data loads. After bootstrap completes, queries switch to incremental processing mode.
§Synthetic Joins
Queries can define synthetic relationships between node types from different sources
via the joins field. This creates virtual edges based on property equality without
requiring physical relationships in the source data.
§Configuration Fields
- id: Unique identifier (referenced by reactions)
- query: Query string in specified language
- queryLanguage: Cypher or GQL (default: Cypher)
- sources: Source IDs to subscribe to
- auto_start: Start automatically (default: true)
- joins: Optional synthetic join definitions
- enableBootstrap: Process initial data (default: true)
- bootstrapBufferSize: Buffer size during bootstrap (default: 10000)
- priority_queue_capacity: Out-of-order event queue size (overrides global)
- dispatch_buffer_capacity: Output buffer size (overrides global)
- dispatch_mode: Broadcast or Channel routing
§Examples
§Basic Cypher Query
queries:
- id: active_orders
query: "MATCH (o:Order) WHERE o.status = 'active' RETURN o"
queryLanguage: Cypher # Optional, this is default
sources: [orders_db]
auto_start: true
enableBootstrap: true
bootstrapBufferSize: 10000§Query with Multiple Sources
queries:
- id: order_customer_join
query: |
MATCH (o:Order)-[:BELONGS_TO]->(c:Customer)
WHERE o.status = 'active'
RETURN o, c
sources: [orders_db, customers_db]§Query with Synthetic Joins
queries:
- id: synthetic_join_query
query: |
MATCH (o:Order)-[:CUSTOMER]->(c:Customer)
RETURN o.id, c.name
sources: [orders_db, customers_db]
joins:
- id: CUSTOMER # Relationship type in query
keys:
- label: Order
property: customer_id
- label: Customer
property: id§High-Throughput Query
queries:
- id: high_volume_processing
query: "MATCH (n:Event) WHERE n.timestamp > timestamp() - 60000 RETURN n"
sources: [event_stream]
priority_queue_capacity: 100000 # Large queue for many out-of-order events
dispatch_buffer_capacity: 10000 # Large output buffer
bootstrapBufferSize: 50000 # Large bootstrap buffer§GQL Query
queries:
- id: gql_users
query: |
{
users(status: "active") {
id
name
email
}
}
queryLanguage: GQL
sources: [users_db]Fields§
§id: StringUnique identifier for the query
query: StringQuery string (Cypher or GQL depending on query_language)
query_language: QueryLanguageQuery language to use (default: Cypher)
middleware: Vec<SourceMiddlewareConfig>Middleware configurations for this query
sources: Vec<SourceSubscriptionConfig>Source subscriptions with optional middleware pipelines
auto_start: boolWhether to automatically start this query (default: true)
joins: Option<Vec<QueryJoinConfig>>Optional synthetic joins for the query
enable_bootstrap: boolWhether to enable bootstrap (default: true)
bootstrap_buffer_size: usizeMaximum number of events to buffer during bootstrap (default: 10000)
priority_queue_capacity: Option<usize>Priority queue capacity for this query (default: server global, or 10000 if not specified)
dispatch_buffer_capacity: Option<usize>Dispatch buffer capacity for this query (default: server global, or 1000 if not specified)
dispatch_mode: Option<DispatchMode>Dispatch mode for this query (default: Channel)
storage_backend: Option<StorageBackendRef>Storage backend for this query (default: in-memory) Can reference a named backend or provide inline configuration
Trait Implementations§
Source§impl Clone for QueryConfig
impl Clone for QueryConfig
Source§fn clone(&self) -> QueryConfig
fn clone(&self) -> QueryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more