public void begin(Application myApp, int capacity, string processName) { string conn_string = this.CONNECTION_STRING; string sql_query = this.SQL_QUERY; System.Reactive.Linq.IQbservable <T> qSource2 = myApp.DefineObservable <T>(() => new ObservablePoller <T>(conn_string, sql_query, 5000)); var streamable = qSource2.ToPointStreamable(x => PointEvent.CreateInsert(DateTime.Now, x), AdvanceTimeSettings.IncreasingStartTime); requestHolder = new RequestManager.RequestHolder(this.TABLENAME, capacity); requestHolder.rowBody = new RequestManager.RowBody(); requestHolder.rowBody.Row = new List <RequestManager.RowElement>(); // DEFINE a simple observer SINK (writes the value to the server console) string hbase_row_key = this.HBASE_ROW_KEY.Clone().ToString(); var mySink2 = myApp.DefineObserver(() => Observer.Create <T>(x => Sink <T>(x, hbase_row_key))); // Compose a QUERY over the source (able to filter out results here if desired) var myQuery2 = from e in streamable select e; // BIND the query to the sink and RUN it using (IDisposable proc = myQuery2.Bind <T>(mySink2).Run(processName)) { Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine("MyStreamInsightServer is running, press Enter to stop the server"); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine(" "); Console.ReadLine(); } Console.ReadLine(); }
public void begin(Application myApp, int capacity, string processName) { string conn_string = this.CONNECTION_STRING; string sql_query = this.SQL_QUERY; System.Linq.IQueryable <SourceEvent> qSource = myApp.DefineEnumerable <SourceEvent>(() => GetEvents(conn_string, sql_query)); IQStreamable <SourceEvent> tSource = qSource.ToPointStreamable <SourceEvent, SourceEvent>( e => CreatePoint(e), AdvanceTimeSettings.IncreasingStartTime); //tSource.Deploy("serverSource"); requestHolder = new RequestManager.RequestHolder(this.TABLENAME, capacity); requestHolder.rowBody = new RequestManager.RowBody(); requestHolder.rowBody.Row = new List <RequestManager.RowElement>(); // DEFINE a simple observer SINK (writes the value to the server console) //var mySink = myApp.DefineObserver(() => Observer.Create<SourceDatabaseEvent>(x => Console.WriteLine("sinkserver: " + x.Product + " SaleDate:" + x.SaleDate + " TransTime:" + x.TransactionTime))); string hbase_row_key = this.HBASE_ROW_KEY; var mySink = myApp.DefineObserver(() => Observer.Create <SourceEvent>(x => Sink <SourceEvent>(x, hbase_row_key))); // DEPLOY the sink to the server for clients to use //mySink.Deploy("serverSink"); // Compose a QUERY over the source (return every even-numbered event) var myQuery = from e in tSource select e; // BIND the query to the sink and RUN it using (IDisposable proc = myQuery.Bind <SourceEvent>(mySink).Run(processName)) { // Wait for the user stops the server Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine("MyStreamInsightServer is running, press Enter to stop the server"); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine(" "); Console.ReadLine(); } }