Show / Hide Table of Contents

# Class ContinuousQuery<TK, TV>

API for configuring continuous cache queries.

Continuous queries allow to register a remote and a listener for cache update events. If an update event passes the filter, it will be sent to the node that executed the query and listener will be notified on that node.

Continuous query can either be executed on the whole topology or only on local node.

In case query is distributed and a new node joins, it will get the filter for the query during discovery process before it actually joins topology, so no updates will be missed.

To execute the query use method QueryContinuous(ContinuousQuery<TK, TV>).

##### Inheritance

System.Object
ContinuousQuery
ContinuousQuery<TK, TV>

##### Inherited Members

ContinuousQuery.DefaultBufferSize
ContinuousQuery.DefaultTimeInterval
ContinuousQuery.DefaultAutoUnsubscribe
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Apache.Ignite.Core.Cache.Query.Continuous

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public class ContinuousQuery<TK, TV> : ContinuousQuery

##### Type Parameters

Name | Description
--- | ---
TK |
TV |

### Constructors

#### ContinuousQuery(ICacheEntryEventListener<TK, TV>)

Constructor.

##### Declaration

    public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr)

##### Parameters

Type | Name | Description
--- | --- | ---
ICacheEntryEventListener<TK, TV> | lsnr | Listener.

#### ContinuousQuery(ICacheEntryEventListener<TK, TV>, ICacheEntryEventFilter<TK, TV>)

Constructor.

##### Declaration

    public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr, ICacheEntryEventFilter<TK, TV> filter)

##### Parameters

Type | Name | Description
--- | --- | ---
ICacheEntryEventListener<TK, TV> | lsnr | Listener.
ICacheEntryEventFilter<TK, TV> | filter | Filter.

#### ContinuousQuery(ICacheEntryEventListener<TK, TV>, ICacheEntryEventFilter<TK, TV>, Boolean)

Constructor.

##### Declaration

    public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr, ICacheEntryEventFilter<TK, TV> filter, bool loc)

##### Parameters

Type | Name | Description
--- | --- | ---
ICacheEntryEventListener<TK, TV> | lsnr | Listener.
ICacheEntryEventFilter<TK, TV> | filter | Filter.
System.Boolean | loc | Whether query should be executed locally.

#### ContinuousQuery(ICacheEntryEventListener<TK, TV>, Boolean)

Constructor.

##### Declaration

    public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr, bool loc)

##### Parameters

Type | Name | Description
--- | --- | ---
ICacheEntryEventListener<TK, TV> | lsnr | Listener.
System.Boolean | loc | Whether query should be executed locally.

### Properties

#### AutoUnsubscribe

Automatic unsubscribe flag. This flag indicates that query filters on remote nodes should be automatically unregistered if master node (node that initiated the query) leaves topology. If this flag is `false`, filters will be unregistered only when the query is cancelled from master node, and won't ever be unregistered if master node leaves grid.

Defaults to `true`.

##### Declaration

    public bool AutoUnsubscribe { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### BufferSize

Buffer size. When a cache update happens, entry is first put into a buffer. Entries from buffer will be sent to the master node only if the buffer is full or time provided via TimeInterval is exceeded.

Defaults to DefaultBufferSize

##### Declaration

    public int BufferSize { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

#### Filter

Optional cache entry filter. Invoked on a node where cache event occurred. If filter returns `false`, then cache entry event will not be sent to a node where continuous query has been started.

Must be either binary or serializable in case query is not local.

##### Declaration

    public ICacheEntryEventFilter<TK, TV> Filter { get; set; }

##### Property Value

Type | Description
--- | ---
ICacheEntryEventFilter<TK, TV> |

#### Listener

Cache entry event listener. Invoked on the node where continuous query execution has been started.

##### Declaration

    public ICacheEntryEventListener<TK, TV> Listener { get; set; }

##### Property Value

Type | Description
--- | ---
ICacheEntryEventListener<TK, TV> |

#### Local

Local flag. When set query will be executed only on local node, so only local entries will be returned as query result.

Defaults to `false`.

##### Declaration

    public bool Local { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### TimeInterval

Time interval. When a cache update happens, entry is first put into a buffer. Entries from buffer will be sent to the master node only if the buffer is full (its size can be provided via BufferSize property) or time provided via this method is exceeded.

Defaults to `0` which means that time check is disabled and entries will be sent only when buffer is full.

##### Declaration

    public TimeSpan TimeInterval { get; set; }

##### Property Value

Type | Description
--- | ---
System.TimeSpan |