本文整理汇总了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();
}
示例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();
}
示例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();
}