public OutputAdapterBase Create <TPayload>(ConsoleOutputConfig configInfo, EventShape eventShape) { switch (eventShape) { case EventShape.Point: return(new ObserverTypedPointOutputAdapter <TPayload>(CreatePointObserverSink <TPayload>(configInfo))); case EventShape.Interval: return(new ObserverTypedIntervalOutputAdapter <TPayload>(CreateIntervalObserverSink <TPayload>(configInfo))); case EventShape.Edge: return(new ObserverTypedEdgeOutputAdapter <TPayload>(CreateEdgeObserverSink <TPayload>(configInfo))); default: throw new ArgumentOutOfRangeException("eventShape"); } }
//Process for Test Data private static void RunTestDataProcess(Application cepApplication) { var config = new TestDataInputConfig() { NumberOfItems = 20, RefreshInterval = TimeSpan.FromMilliseconds(500), TimestampIncrement = TimeSpan.FromMilliseconds(500), AlwaysUseNow = true, EnqueueCtis = false }; AdvanceTimeSettings ats = new AdvanceTimeSettings(new AdvanceTimeGenerationSettings( TimeSpan.FromMilliseconds(750), TimeSpan.FromMilliseconds(200)), null, AdvanceTimePolicy.Drop); var data = RxStream<TestDataEvent>.Create(cepApplication, typeof(TestDataInputFactory), config, EventShape.Point, ats); var sinkConfig = new ConsoleOutputConfig() { ShowCti = true, CtiEventColor = ConsoleColor.Blue, InsertEventColor = ConsoleColor.Green }; var binding = data.ToBinding(cepApplication, typeof(ConsoleOutputFactory), sinkConfig, EventShape.Point); binding.Run("Hello"); }
//Process for Yahoo Data private static void RunYahooDataProcess(Application cepApplication) { var config = new YahooDataInputConfig() { Symbols = new string[] { "AAPL", "DELL", "MSFT", "GOOG", "GE" }, RefreshInterval = TimeSpan.FromSeconds(5), TimestampIncrement = TimeSpan.FromSeconds(5), AlwaysUseNow = true, EnqueueCtis = false }; AdvanceTimeSettings ats = new AdvanceTimeSettings(new AdvanceTimeGenerationSettings( TimeSpan.FromMilliseconds(750), TimeSpan.FromMilliseconds(200)), null, AdvanceTimePolicy.Drop); var data = RxStream<YahooDataEvent>.Create(cepApplication, typeof(YahooDataInputFactory), config, EventShape.Point, ats); var sinkConfig = new ConsoleOutputConfig() { ShowCti = true, ShowPayloadToString = false, CtiEventColor = ConsoleColor.Blue, InsertEventColor = ConsoleColor.Green }; var myQuery = from x in data.ToPointEventStream() select new { x.Symbol, x.LastTradePrice, x.LastUpdateTime }; var binding = myQuery.ToBinding(cepApplication, typeof(ConsoleOutputFactory), sinkConfig, EventShape.Point); binding.Run("Hello"); }
public ConsoleDataConsumer(ConsoleOutputConfig configuration) : base(configuration) { }