Table of Contents

Interface IContinuousQuerySource<T>

Namespace
Apache.Ignite.Table
Assembly
Apache.Ignite.dll

Represents an object which can be queried continuously.

public interface IContinuousQuerySource<T>

Type Parameters

T

Data type.

Methods

QueryContinuouslyAsync(ContinuousQueryOptions?, CancellationToken)

Starts a continuous query which listens to data events within the underlying table and returns an infinite IAsyncEnumerable<T> of batched events.

The query will be stopped when the IAsyncEnumerator<T> returned from GetAsyncEnumerator(CancellationToken) call is disposed. This happens automatically when you break out of the await foreach loop or use System.Linq.Async methods.

IAsyncEnumerable<ITableRowEventBatch<T>> QueryContinuouslyAsync(ContinuousQueryOptions? options = null, CancellationToken cancellationToken = default)

Parameters

options ContinuousQueryOptions

Options.

cancellationToken CancellationToken

Cancellation token.

Returns

IAsyncEnumerable<ITableRowEventBatch<T>>

Infinite IAsyncEnumerable<T> representing an asynchronous stream of batched table events.

QueryContinuouslyAsync(Expression<Func<ITableRowEvent<T>, bool>>, ContinuousQueryOptions?, CancellationToken)

Starts a continuous query with a server-side filter expressed as a LINQ expression tree and returns an infinite IAsyncEnumerable<T> of batched events.

The expression is translated into a SQL predicate and evaluated on the server, so only matching events are sent to the client. This is a strongly-typed alternative to the SQL-string overload.

Member mapping. The following members of ITableRowEvent<T> are recognized inside the expression:
  • Entry.<column> — current value (translates to CUR.<column>). For key-value views use Entry.Key.<column> or Entry.Value.<column>.
  • OldEntry.<column> — old value (translates to OLD.<column>).
  • Type — event type (translates to EVENT.TYPE_ID).
Event-type behavior. Example.
view.QueryContinuouslyAsync(e =>
    e.Entry!.Price > 300 && e.Type == TableRowEventType.Updated);

The query is stopped when the IAsyncEnumerator<T> returned from GetAsyncEnumerator(CancellationToken) is disposed. This happens automatically when you break out of the await foreach loop or use System.Linq.Async methods.

[RequiresUnreferencedCode("LINQ provider does not support trimming and AOT scenarios. Use SQL queries instead.")]
IAsyncEnumerable<ITableRowEventBatch<T>> QueryContinuouslyAsync(Expression<Func<ITableRowEvent<T>, bool>> remoteFilter, ContinuousQueryOptions? options = null, CancellationToken cancellationToken = default)

Parameters

remoteFilter Expression<Func<ITableRowEvent<T>, bool>>

Server-side filter as a LINQ expression over ITableRowEvent<T>.

options ContinuousQueryOptions

Continuous query options, or null for defaults.

cancellationToken CancellationToken

Cancellation token.

Returns

IAsyncEnumerable<ITableRowEventBatch<T>>

Infinite IAsyncEnumerable<T> representing an asynchronous stream of batched table events.

QueryContinuouslyAsync(string, ICollection<object?>?, ContinuousQueryOptions?, CancellationToken)

Starts a continuous query with a server-side SQL filter and returns an infinite IAsyncEnumerable<T> of batched events.

Only events matching remoteFilterSql are sent to the client. This reduces network traffic by filtering events at the source before transmission.

Column reference syntax. Use the CUR, OLD, and EVENT virtual table names to reference values:
  • CUR.<column> — current value of a column (after the operation).
  • OLD.<column> — old value of a column (before the operation).
  • EVENT.PARTITION_ID — partition ID (BIGINT).
  • EVENT.TYPE_ID — event type ID (INT): 0=CREATED, 1=UPDATED, 2=REMOVED, 3=ARCHIVED (see TableRowEventType).
  • EVENT.COMMIT_TIMESTAMP — physical commit timestamp, Unix time, in milliseconds (BIGINT).

Use ? for positional parameters supplied via remoteFilterArgs. Quote column names containing spaces or reserved words with double quotes (e.g. CUR."column with spaces").

Event-type behavior.
  • Created: OLD columns are null; CUR columns contain the inserted row.
  • Updated: both OLD and CUR columns are available.
  • Removed: OLD columns contain the deleted row; CUR columns are null.
Example.
view.QueryContinuouslyAsync(
    "CUR.PRICE > ? AND EVENT.TYPE_ID = ? AND EVENT.COMMIT_TIMESTAMP > ?",
    [300, (int)TableRowEventType.Updated, DateTimeOffset.UtcNow.AddHours(-1).ToUnixTimeMilliseconds()]);

The query is stopped when the IAsyncEnumerator<T> returned from GetAsyncEnumerator(CancellationToken) is disposed. This happens automatically when you break out of the await foreach loop or use System.Linq.Async methods.

IAsyncEnumerable<ITableRowEventBatch<T>> QueryContinuouslyAsync(string remoteFilterSql, ICollection<object?>? remoteFilterArgs = null, ContinuousQueryOptions? options = null, CancellationToken cancellationToken = default)

Parameters

remoteFilterSql string

Server-side SQL predicate; see remarks for the supported column-reference syntax.

remoteFilterArgs ICollection<object>

Positional arguments for ? placeholders in remoteFilterSql, or null.

options ContinuousQueryOptions

Continuous query options, or null for defaults.

cancellationToken CancellationToken

Cancellation token.

Returns

IAsyncEnumerable<ITableRowEventBatch<T>>

Infinite IAsyncEnumerable<T> representing an asynchronous stream of batched table events.