Starting and Stopping Queries

This topic describes how to start and stop a query in a StreamInsight server.

Once a query object is created, it can be started and stopped. The Start() call instantiates the necessary adapters according to the adapter factories, starts the StreamInsight server and calls the Start() methods of the adapters. The Stop() call notifies the adapters that the query is stopping and then shuts down the running query.

Query query = application.CreateQuery("query", "description for query", myQueryBinder);

query.Start();

// Wait for the condition to stop the query, for example, when one of the adapters signals its completion.

query.Stop();

Diagnostic information can only be retrieved from a query while it is running, that is, before the Stop() call. For more information, see Monitoring the StreamInsight Server and Queries