Overview of Continuous Queries

When used in a query agent deployed in a TIBCO BusinessEvents cluster, 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.

When used in a query agent deployed stand-alone to perform event stream processing, continuous queries listen to and process the data stream for a specified event.

Enabling Continous Query

Only query agents enabled for continuous query uses a continuous query. In the project CDD file, add the following property to the query agent properties:

be.agent.query.continuous.allow=true

By default this property is set to false. Only agents with this property set to true will attempt to use continous query.

Tip: A continuous query must be executed using the Query.Statement.executeWithCallback() function. Snapshot queries can also use this function. However, when you set the argument IsContinuous to true, the query runs as a continuous query. See Overview of Continuous Queries for more details.

Executing a Continuous Query

For continuous queries, use the Query.Statement.executeWithCallback() function (and a variant of this function called Query.Statement.executeWithBatchCallback()) with the IsContinuous argument set to true.

See Callback Rule Function Data Usage. and See Two Types of Queries—Snapshot and Continuous for more information.

Ending a Continuous Query

A continuous query only ends when one of the following occurs:

  • You explicitly stop it.
  • Its query statement is closed.
  • Its query definition is deleted.
  • The query agent engine stops.