当前位置: 首页>>代码示例>>C#>>正文


C# Query.Stop方法代码示例

本文整理汇总了C#中Query.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Query.Stop方法的具体用法?C# Query.Stop怎么用?C# Query.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query.Stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: backgroundWorker1_DoWork

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            var streamInsightInstanceName = Properties.Settings.Default.InstanceName;
            var server = Server.Create(streamInsightInstanceName);
            var application = server.CreateApplication("yahoofinancetest");

            // Configure output adapter
            var outputConfig = new StackerConfig
            {
                StackerCtlPipeName = stackerCtl1.PipeName,
                StackerCtlHostName = "localhost"
            };

            var inputConfig = new YahooFinanceConfig
            {
                StockSymbol = "^GSPC",
                StockName = "S&P 500",
                Timeout = 10000,
                Interval = 1000
            };

            var input = CepStream<StockQuote>.Create("yahoo", typeof(YahooFinanceFactory), inputConfig, EventShape.Point);

            // Create query and bind to the output adapter
            query = input.ToQuery(application, "query", "...", typeof(StackerFactory), outputConfig, EventShape.Point, StreamEventOrder.ChainOrdered);

            // Start query
            query.Start();

            // Wait until query change state
            DiagnosticView diagnosticView;
            stopFlag = false;
            do
            {
                Thread.Sleep(100);
                diagnosticView = query.Application.Server.GetDiagnosticView(query.Name);
            } while (!stopFlag && (string)diagnosticView["QueryState"] == "Running");

            // Stop query
            query.Stop();

            Thread.Sleep(1000);

            application.Delete();
            server.Dispose();
        }
开发者ID:MattCollinge,项目名称:Spikes,代码行数:46,代码来源:YahooTestWnd.cs

示例2: TestFacebook

        public void TestFacebook()
        {
            var streamInsightInstanceName = Properties.Settings.Default.InstanceName;
            var server = Server.Create(streamInsightInstanceName);
            var application = server.CreateApplication("facebooktest");

            var inputConfig = new FacebookConfig
            {
                AccessToken = AccessTokenTbx.Text,
                UsernameOrUniqueId = UsernameOrUniqueIdTbx.Text,
                RefreshPeriod = int.Parse(RefreshIntervalTbx.Text) * 1000
            };

            var input = CepStream<FacebookItem>.Create("facebook", typeof(FacebookFactory), inputConfig, EventShape.Point);

            // Configure output adapter
            var outputConfig = new StackerConfig
            {
                StackerCtlPipeName = stackerCtl1.PipeName,
                StackerCtlHostName = "localhost"
            };

            // Create query and bind to the output adapter
            var expr = from e in input
                       select new {e.Id, e.FromName, Message = !string.IsNullOrEmpty(e.Message) ? e.Message : e.Description };

            query = expr.ToQuery(application, "query", "...", typeof(StackerFactory), outputConfig, EventShape.Point, StreamEventOrder.FullyOrdered);

            // Start query
            query.Start();

            // Wait until query change state
            DiagnosticView diagnosticView;
            stopFlag = false;
            do
            {
                Thread.Sleep(100);
                diagnosticView = query.Application.Server.GetDiagnosticView(query.Name);
            } while (!stopFlag && (string)diagnosticView["QueryState"] == "Running");

            // Stop query
            query.Stop();

            application.Delete();
            server.Dispose();
        }
开发者ID:MattCollinge,项目名称:Spikes,代码行数:46,代码来源:FaceBookTestWnd.cs

示例3: TestTwitter

        public void TestTwitter()
        {
            var streamInsightInstanceName = Properties.Settings.Default.InstanceName;
            var server = Server.Create(streamInsightInstanceName);
            var application = server.CreateApplication("twittertest");

            var inputConfig = new TwitterConfig
                {
                    Username = UserNameTbx.Text,
                    Password = PasswordTbx.Text
                };

            if (FilterModeRbn.Checked)
            {
                inputConfig.Mode = TwitterMode.Filter;
                inputConfig.Parameters = "track=" + FilterParametersTbx.Text;
            }
            else if (SampleModeRbn.Checked)
                inputConfig.Mode = TwitterMode.Sample;

            var input = CepStream<Tweet>.Create("twitter", typeof(TwitterFactory), inputConfig, EventShape.Point);

            // Configure output adapter
            var outputConfig = new StackerConfig
                {
                    StackerCtlPipeName = stackerCtl1.PipeName,
                    StackerCtlHostName = "localhost"
                };

            // Create query and bind to the output adapter
            query = input.ToQuery(application, "query", "...", typeof(StackerFactory), outputConfig, EventShape.Point, StreamEventOrder.ChainOrdered);

            // Start query
            query.Start();

            // Wait until query change state
            DiagnosticView diagnosticView;
            stopFlag = false;
            do
            {
                Thread.Sleep(100);
                diagnosticView = query.Application.Server.GetDiagnosticView(query.Name);
            } while (!stopFlag && (string)diagnosticView["QueryState"] == "Running");

            // Stop query
            query.Stop();

            application.Delete();
            server.Dispose();
        }
开发者ID:MattCollinge,项目名称:Spikes,代码行数:50,代码来源:TwitterTestWnd.cs


注:本文中的Query.Stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。