Continuous queries listen to and process the data stream of notifications sent from the cache. Notifications are sent when entities are added to, modified or deleted from the cache.
Unlike snapshot queries, continuous queries do not examine the cached entities themselves. Entities that were created before a query starts are not visible to it— unless they are modified while the query is running.
You use the Query.Statement.executeWithCallback() function with the
IsContinuous argument set to
true to execute a continuous query statement. See
Using Data from a Callback Rule Function. and See
Two Main Types of Queries for more information.
Continuous queries use windows to contain the entities that are added or changed.A
window is a boundary for analyzing data streams. It is a container in which events and concepts are held and processed by the query. Entities enter and leave the window as determined by the window type and how it is configured.
Explicit windows (sliding, tumbling, and time windows) define the window boundary, that is, a condition that limits the lifecycle of the entities in the window.
With implicit windows, the lifetime of the entities themselves control the lifecycle of the entities in the implicit window. Implicit windows process changes, additions, and deletions affecting the specified entities until the query ends.
See Working With Sliding, Tumbling, and Time Windows for content that applies to all these types of explicit windows.
Implicit Window A group by clause in the select statement determines that the query is a continuous query using an implicit window. See
Working With Implicit Windows.
Sliding Window Has a specified queue size, into which entities flow. When the queue is full and a new entity arrives, the oldest entity in the queue is removed from the window (FIFO). See
Sliding Window Examples
Tumbling Window Has a specified queue size, specified as a certain number of entities, and empties each time the maximum size is exceeded. Emptying the window completes one cycle. The lifetime of an entity in the window, therefore, is one cycle. See
Tumbling Window Examples
Time Window Specifies a time period during which entities remain in the window. See
Time Window Examples.