Skip to main content

QueryConfig

Struct QueryConfig 

Source
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: String

Unique identifier for the query

§query: String

Query string (Cypher or GQL depending on query_language)

§query_language: QueryLanguage

Query language to use (default: Cypher)

§middleware: Vec<SourceMiddlewareConfig>

Middleware configurations for this query

§sources: Vec<SourceSubscriptionConfig>

Source subscriptions with optional middleware pipelines

§auto_start: bool

Whether to automatically start this query (default: true)

§joins: Option<Vec<QueryJoinConfig>>

Optional synthetic joins for the query

§enable_bootstrap: bool

Whether to enable bootstrap (default: true)

§bootstrap_buffer_size: usize

Maximum 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

Source§

fn clone(&self) -> QueryConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for QueryConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<QueryConfig> for QueryRuntime

Source§

fn from(config: QueryConfig) -> Self

Converts to this type from the input type.
Source§

impl Serialize for QueryConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,