Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.ServiceModel;
- using Microsoft.ComplexEventProcessing;
- using Microsoft.ComplexEventProcessing.Linq;
- using StreamInsightLibrary;
- using StreamInsightPayLoad;
- namespace StreamInsightApplication {
- class Program {
- static void Main(string[] args) {
- Server server = Server.Connect(new EndpointAddress(@"http://localhost/StreamInsight/MyInstance"));
- //var server = Server.Create("MyInstance");
- if (server.Applications.ContainsKey("myHostApp")) {
- server.Applications["myHostApp"].Delete();
- }
- Application myApp = server.CreateApplication("myHostApp");
- //Application myApp = myAppList["myHostApp"];
- var inputConfig = new StreamInsightInputConfig { QueueName = "testqueue" };
- var outputConfig = new StreamInsightOutputConfig { Filepath = "C:\\Users\\pjain\\Desktop\\testFile.txt" };
- try {
- CepStream<AnalyticsPayload> cepStream = CepStream<AnalyticsPayload>.Create("TaskLogStream", typeof(StreamInsightInputFactory), inputConfig, EventShape.Point);
- CepStream<AnalyticsPayload> filteredCepStream = from e in cepStream
- select e;
- Query query = filteredCepStream.ToQuery(
- myApp,
- Guid.NewGuid().ToString(),
- "description",
- typeof(StreamInsightOutputFactory),
- outputConfig,
- EventShape.Point,
- StreamEventOrder.ChainOrdered);
- query.Start();
- Console.WriteLine("The query {0} is running for the application {1}", query.ShortName, myApp.ShortName);
- //Wait for Keystroke to end
- //Console.WriteLine("Press any key to stop the query stream and quit ........");
- //Console.ReadLine();
- query.Stop();
- } catch (Exception e) {
- Console.WriteLine(e.Message + e.StackTrace);
- } finally {
- myApp.Delete();
- server.Dispose();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment