private static void RunQuery(CepStream <Payload> cepStream, Application application) { // Configure output adapter // Create query and bind to the output adapter var query = cepStream.ToQuery(application, Guid.NewGuid().ToString(), "description", typeof(PayloadOutputFactory), outputConfig, EventShape.Point, StreamEventOrder.ChainOrdered); // Start query query.Start(); // Wait until query change state DiagnosticView diagnosticView; do { Thread.Sleep(100); diagnosticView = query.Application.Server.GetDiagnosticView(query.Name); } while ((string)diagnosticView[DiagnosticViewProperty.QueryState] == "Running"); // Stop query query.Stop(); }
/// <summary> /// Binds a stream to output adapter and runs the query /// </summary> /// <param name="cepStream"></param> private static void runQuery(CepStream<StockQuote> cepStream, Application application) { // Configure output adapter var outputConfig = new StockQuoteOutputConfig(); // Create query and bind to the output adapter var query = cepStream.ToQuery(application, Guid.NewGuid().ToString(), "description", typeof(StockQuoteOutputFactory), outputConfig, EventShape.Point, StreamEventOrder.ChainOrdered); // Start query query.Start(); // Wait until query change state DiagnosticView diagnosticView; do { Thread.Sleep(100); diagnosticView = query.Application.Server.GetDiagnosticView(query.Name); } while ((string)diagnosticView[DiagnosticViewProperty.QueryState] == "Running"); // Stop query query.Stop(); }