public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; configuration.AddEventType("StockTick", typeof(StockTick).FullName); _epService = EPServiceProviderManager.GetProvider(container, "TestStockTickerRSI", configuration); _epService.Initialize(); _stockListener = new RSIStockTickerListener(_epService, PERIOD); _expressionText = "every tick=StockTick(stockSymbol='" + SYMBOL + "')"; //_expressionText = "every tick1=StockTick(stockSymbol='GOOG') -> tick2=StockTick(stockSymbol='GOOG')"; _factory = _epService.EPAdministrator.CreatePattern(_expressionText); _factory.Events += _stockListener.Update; var rsiEvent = typeof(RSIEvent).FullName; var viewExpr = "select * from " + rsiEvent + ".win:length(1)"; _rsiListener = new RSIListener(); _factory = _epService.EPAdministrator.CreateEPL(viewExpr); _factory.Events += _rsiListener.Update; _rsiListener.Reset(); }
public static EPServiceProvider GetProvider( string providerURI) { return(GetProvider( ContainerExtensions.CreateDefaultContainer(), providerURI)); }
public void TestNestedProperties() { var container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(container); configuration.AddEventType <Figure>(); var ep = EPServiceProviderManager.GetProvider(container, "testNestedProperties", configuration); var ul = new SupportUpdateListener(); ep.EPAdministrator.CreateEPL("select * from Figure").Events += ul.Update; var source = new AdapterInputSource("regression/nestedProperties.csv"); var spec = new CSVInputAdapterSpec(source, "Figure"); var adapter = new CSVInputAdapter(_container, ep, spec); adapter.Start(); Assert.IsTrue(ul.IsInvoked()); var e = ul.AssertOneGetNewAndReset(); var f = (Figure)e.Underlying; Assert.AreEqual(1, f.Point.X); }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.Runtime.Threading.IsInternalTimerEnabled = false; configuration.Common.AddEventType("MarketDataEvent", typeof(MarketDataEvent).FullName); configuration.Common.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; _runtime = EPRuntimeProvider.GetRuntime("TestTicksPerSecondStatement", configuration); _runtime.Initialize(); _runtime.EventService.AdvanceTime(0); TicksPerSecondStatement.Create(_runtime); var stmt = TicksFalloffStatement.Create(_runtime); _listener = new SupportUpdateListener(); stmt.Events += _listener.Update; // Use external clocking for the test _runtime.EventService.ClockExternal(); }
public void Run() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); // load config - this defines the XML event types to be processed var configFile = "esper.examples.cfg.xml"; var url = container.ResourceManager().ResolveResourceURL(configFile); var config = new Configuration(container); config.Configure(url); // get engine instance var epService = EPServiceProviderManager.GetProvider(container, engineURI, config); // set up statement var rfidStmt = RFIDTagsPerSensorStmt.Create(epService.EPAdministrator); rfidStmt.Events += LogRate; // Send events var eventCount = 0; while (eventCount < numEvents) { SendEvent(epService.EPRuntime); eventCount++; } }
public void TestNestedProperties() { var container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(container); configuration.Common.AddEventType(typeof(Figure)); var runtime = EPRuntimeProvider.GetRuntime("testNestedProperties", configuration); var ul = new SupportUpdateListener(); var stmt = CompileUtil.CompileDeploy(runtime, "select * from Figure").Statements[0]; stmt.Events += ul.Update; var source = new AdapterInputSource(_container, "regression/nestedProperties.csv"); var spec = new CSVInputAdapterSpec(source, "Figure"); var adapter = new CSVInputAdapter(runtime, spec); adapter.Start(); Assert.IsTrue(ul.IsInvoked()); var e = ul.AssertOneGetNewAndReset(); var f = (Figure)e.Underlying; Assert.AreEqual(1, f.Point.X); }
private static IContainer CreateContainer() { var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var container = ContainerExtensions.CreateDefaultContainer(false); container.Register <IResourceManager>( xx => new DefaultResourceManager( true, Path.GetFullPath(Path.Combine(baseDirectory, "..", "..", "..", "etc")), Path.GetFullPath(Path.Combine(baseDirectory, "..", "..", "..", "..", "etc")), Path.GetFullPath(Path.Combine(baseDirectory, "..", "..", "..", "..", "..", "etc"))), Lifespan.Singleton); SupportEventTypeFactory.RegisterSingleton(container); SupportExprNodeFactory.RegisterSingleton(container); SupportDatabaseService.RegisterSingleton(container); SupportJoinResultNodeFactory.RegisterSingleton(container); container .InitializeDefaultServices() .InitializeDatabaseDrivers() .RegisterDatabaseDriver(typeof(DbDriverPgSQL)); return(container); }
public void TestIt() { var stmtText = "insert into ThroughputPerFeed " + " select feed, count(*) as cnt " + "from " + typeof(FeedEvent).FullName + ".win:time_batch(1 sec) " + "group by feed"; var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; EPServiceProviderManager.PurgeDefaultProvider(); var engine = EPServiceProviderManager.GetDefaultProvider(configuration); var stmt = engine.EPAdministrator.CreateEPL(stmtText); stmt.Events += DisplayEvents; /* * while(true) * { * FeedEvent event; * event = new FeedEvent(FeedEnum.FEED_A, "IBM", 70); * engine.GetEPRuntime().SendEvent(event); * event = new FeedEvent(FeedEnum.FEED_B, "IBM", 70); * engine.GetEPRuntime().SendEvent(event); * } */ }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.EngineDefaults.Threading.IsInternalTimerEnabled = false; configuration.AddEventType("MarketDataEvent", typeof(MarketDataEvent).FullName); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; _epService = EPServiceProviderManager.GetProvider(container, "TestTicksPerSecondStatement", configuration); _epService.Initialize(); _epService.EPRuntime.SendEvent(new CurrentTimeEvent(0)); TicksPerSecondStatement.Create(_epService.EPAdministrator); var stmt = TicksFalloffStatement.Create(_epService.EPAdministrator); _listener = new SupportUpdateListener(); stmt.Events += _listener.Update; // Use external clocking for the test _epService.EPRuntime.SendEvent(new TimerControlEvent(TimerControlEvent.ClockTypeEnum.CLOCK_EXTERNAL)); }
/// <summary> /// Runs this instance. /// </summary> public void Run() { var container = ContainerExtensions.CreateDefaultContainer(); // Configure engine with event names to make the statements more readable. // This could also be done in a configuration file. var configuration = new Configuration(container); configuration.AddEventType("TxnEventA", typeof(TxnEventA).FullName); configuration.AddEventType("TxnEventB", typeof(TxnEventB).FullName); configuration.AddEventType("TxnEventC", typeof(TxnEventC).FullName); // Get engine instance EPServiceProvider epService = EPServiceProviderManager.GetProvider(container, _engineURI, configuration); // We will be supplying timer events externally. // We will assume that each bucket arrives within a defined period of time. epService.EPRuntime.SendEvent(new TimerControlEvent(TimerControlEvent.ClockTypeEnum.CLOCK_EXTERNAL)); // Set up statement for listening to combined events var combinedEventStmt = CombinedEventStmt.Create(epService.EPAdministrator); combinedEventStmt.Events += LogCombinedEvents; // Set up statements for realtime summary latency data - overall totals and totals per customer and per supplier RealtimeSummaryStmt realtimeSummaryStmt = new RealtimeSummaryStmt(epService.EPAdministrator); realtimeSummaryStmt.TotalsStatement.Events += LogSummaryTotals; realtimeSummaryStmt.CustomerStatement.Events += (sender, e) => LogSummaryGroup("customerId", e); realtimeSummaryStmt.SupplierStatement.Events += (sender, e) => LogSummaryGroup("supplierId", e); // Set up statement for finding missing events var findMissingEventStmt = FindMissingEventStmt.Create(epService.EPAdministrator); findMissingEventStmt.Events += FindMissingEvent; // The feeder to feed the engine var feeder = new FeederOutputStream(epService.EPRuntime); // Generate transactions var source = new TransactionEventSource(_numTransactions); var output = new ShuffledBucketOutput(source, feeder, _bucketSize); // Feed events if (_continuousSimulation) { while (true) { output.Output(); Thread.Sleep(5000); // Send a batch every 5 seconds } } else { output.Output(); } }
public void Init(int sleepListenerMillis) { var container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(container); configuration.Common.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; configuration.Common.AddEventType("Market", typeof(MarketData)); _runtime = EPRuntimeProvider.GetRuntime("benchmark", configuration); _marketDataSender = _runtime.EventService.GetEventSender("Market"); _sleepMillis = sleepListenerMillis; }
public virtual void SetUp() { var container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(container); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; configuration.AddEventType("TxnEventA", typeof(TxnEventA).FullName); configuration.AddEventType("TxnEventB", typeof(TxnEventB).FullName); configuration.AddEventType("TxnEventC", typeof(TxnEventC).FullName); epService = EPServiceProviderManager.GetProvider(container, "TestStmtBase", configuration); epService.Initialize(); }
public void Init(int sleepListenerMillis) { var container = ContainerExtensions.CreateDefaultContainer(); Configuration configuration = new Configuration(container); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; configuration.AddEventType("Market", typeof(MarketData)); EPServiceProvider epService = EPServiceProviderManager.GetProvider("benchmark", configuration); epAdministrator = epService.EPAdministrator; epRuntime = epService.EPRuntime; sleepMillis = sleepListenerMillis; }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.Common.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; _runtime = EPRuntimeProvider.GetDefaultRuntime(configuration); _sender = _runtime.EventService.GetEventSender(typeof(OperationMeasurement).FullName); new ErrorRateMonitor(); }
public static EPServiceProvider GetDefaultProvider( Configuration configuration) { var container = configuration.Container; if (container == null) { container = ContainerExtensions.CreateDefaultContainer(); } return(GetProvider( container, EPServiceProviderConstants.DEFAULT_ENGINE_URI, configuration)); }
/// <summary> /// Setup the esper. /// </summary> static void SetupEsper() { _container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(_container); configuration.Common.AddEventType(typeof(BidData)); configuration.Compiler.Expression.IsUdfCache = true; configuration.Runtime.Logging.IsEnableExecutionDebug = false; configuration.Runtime.Logging.IsEnableTimerDebug = false; configuration.Runtime.MetricsReporting.IsEnableMetricsReporting = false; configuration.Runtime.MetricsReporting.IsThreading = false; _runtime = EPRuntimeProvider.GetDefaultRuntime(configuration); }
public static EPServiceProvider GetProvider( string providerURI, Configuration configuration) { var container = configuration.Container; if (container == null) { container = ContainerExtensions.CreateDefaultContainer(); } return(GetProvider( container, providerURI, configuration)); }
public virtual void SetUp() { var container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(container); configuration.Common.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; configuration.Common.AddEventType("TxnEventA", typeof(TxnEventA)); configuration.Common.AddEventType("TxnEventB", typeof(TxnEventB)); configuration.Common.AddEventType("TxnEventC", typeof(TxnEventC)); _runtime = EPRuntimeProvider.GetRuntime("TestStmtBase", configuration); _runtime.Initialize(); _eventService = _runtime.EventService; }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; EPServiceProviderManager.PurgeDefaultProvider(); var epService = EPServiceProviderManager.GetDefaultProvider(configuration); new ErrorRateMonitor(); _runtime = epService.EPRuntime; }
public void Run() { var container = ContainerExtensions.CreateDefaultContainer(false) .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.Common.AddEventType("PriceLimit", typeof(PriceLimit)); configuration.Common.AddEventType("StockTick", typeof(StockTick)); Log.Info("Setting up EPL"); var runtime = EPRuntimeProvider.GetRuntime(_engineURI, configuration); runtime.Initialize(); var eventService = runtime.EventService; new StockTickerMonitor(runtime, new StockTickerResultListener()); Log.Info("Generating test events: 1 million ticks, ratio 2 hits, 100 stocks"); var generator = new StockTickerEventGenerator(); var stream = generator.MakeEventStream(1000000, 500000, 100, 25, 30, 48, 52, false); Log.Info("Generating " + stream.Count + " events"); Log.Info("Sending " + stream.Count + " limit and tick events"); foreach (var @event in stream) { eventService.SendEventBean(@event, @event.GetType().Name); if (_continuousSimulation) { try { Thread.Sleep(200); } catch (ThreadInterruptedException e) { Log.Debug("Interrupted", e); break; } } } Log.Info("Done."); }
public void SetUp() { _listener = new StockTickerResultListener(); var container = ContainerExtensions.CreateDefaultContainer(false) .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.Common.AddEventType("PriceLimit", typeof(PriceLimit).FullName); configuration.Common.AddEventType("StockTick", typeof(StockTick).FullName); _runtime = EPRuntimeProvider.GetRuntime("TestStockTickerMultithreaded", configuration); _runtime.Initialize(); new StockTickerMonitor(_runtime, _listener); }
private static IContainer CreateContainer() { var container = ContainerExtensions.CreateDefaultContainer(false); container.Register <IResourceManager>( xx => new DefaultResourceManager(true, @"..\..\..\etc", @"..\..\..\..\etc", @"..\..\..\..\..\etc"), Lifespan.Singleton); container .InitializeDefaultServices() .InitializeDatabaseDrivers(); return(container); }
public void Run() { Log.Info("Setting up engine instance."); var container = ContainerExtensions.CreateDefaultContainer(); var config = new Configuration(container); config.Common.EventMeta.DefaultEventRepresentation = EventUnderlyingType.MAP; // use Map-type events for testing config.Compiler.AddPlugInVirtualDataWindow("sample", "samplevdw", typeof(SampleVirtualDataWindowFactory).FullName); config.Common.AddEventType(typeof(SampleTriggerEvent)); config.Common.AddEventType(typeof(SampleJoinEvent)); config.Common.AddEventType(typeof(SampleMergeEvent)); var runtime = EPRuntimeProvider.GetRuntime("LargeExternalDataExample", config); // First: Create an event type for rows of the external data - here the example use a Map-based event and any of the other types (POJO, XML) can be used as well. // Populate event property names and types. // Note: the type must match the data returned by virtual data window indexes. CompileDeploy(runtime, "create schema SampleEvent as (key1 string, key2 string, value1 int, value2 double)"); Log.Info("Creating named window with virtual."); // Create Named Window holding SampleEvent instances CompileDeploy(runtime, "create window MySampleWindow.sample:samplevdw() as SampleEvent"); // Example subquery Log.Info("Running subquery example."); RunSubquerySample(runtime); // Example joins Log.Info("Running join example."); RunJoinSample(runtime); // Sample FAF Log.Info("Running fire-and-forget query example."); RunSampleFireAndForgetQuery(runtime); // Sample On-Merge Log.Info("Running on-merge example."); RunSampleOnMerge(runtime); // Cleanup Log.Info("Destroying engine instance, sample completed successfully."); runtime.Destroy(); }
/// <summary> /// Setup the esper. /// </summary> static void SetupEsper() { _container = ContainerExtensions.CreateDefaultContainer(); var configuration = new Configuration(_container); configuration.AddEventType <BidData>(); configuration.EngineDefaults.Expression.IsUdfCache = true; configuration.EngineDefaults.Logging.IsEnableExecutionDebug = false; configuration.EngineDefaults.Logging.IsEnableTimerDebug = false; configuration.EngineDefaults.MetricsReporting.IsEnableMetricsReporting = false; configuration.EngineDefaults.MetricsReporting.IsThreading = false; _espServiceProvider = (EPServiceProviderSPI)EPServiceProviderManager.GetDefaultProvider(configuration); _espAdministrator = _espServiceProvider.EPAdministrator; _espRuntime = _espServiceProvider.EPRuntime; }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; _listener = new MatchAlertListener(); EPServiceProviderManager.PurgeDefaultProvider(); _epService = EPServiceProviderManager.GetDefaultProvider(configuration); _epService.Initialize(); new MatchMakingMonitor(_epService, _listener); }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.AddEventType("FraudWarning", typeof(FraudWarning).FullName); configuration.AddEventType("Withdrawal", typeof(Withdrawal).FullName); configuration.EngineDefaults.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; _epService = EPServiceProviderManager.GetProvider(container, "FraudMonitorTest", configuration); _epService.EPRuntime.SendEvent(new TimerControlEvent(TimerControlEvent.ClockTypeEnum.CLOCK_EXTERNAL)); _listener = new SupportUpdateListener(); new FraudMonitor(_epService, _listener.Update); }
public void SetUp() { _listener = new StockTickerResultListener(); var container = ContainerExtensions.CreateDefaultContainer(false) .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.AddEventType("PriceLimit", typeof(PriceLimit).FullName); configuration.AddEventType("StockTick", typeof(StockTick).FullName); _epService = EPServiceProviderManager.GetProvider( container, "TestStockTickerSimple", configuration); // To reduce logging noise and get max performance _epService.EPRuntime.SendEvent(new TimerControlEvent(TimerControlEvent.ClockTypeEnum.CLOCK_EXTERNAL)); }
public void SetUp() { _container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var url = _container.ResourceManager().ResolveResourceURL("esper.examples.cfg.xml"); var config = new Configuration(_container); config.Configure(url); _runtime = EPRuntimeProvider.GetRuntime("AutoIdSim", config); _runtime.Initialize(); _listener = new SupportUpdateListener(); var rfidStmt = RFIDTagsPerSensorStmt.Create(_runtime); rfidStmt.Events += _listener.Update; }
private static IContainer CreateContainer() { var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var container = ContainerExtensions.CreateDefaultContainer(false); container.Register <IResourceManager>( xx => new DefaultResourceManager( true, Path.GetFullPath(Path.Combine(baseDirectory, "..", "..", "..", "etc")), Path.GetFullPath(Path.Combine(baseDirectory, "..", "..", "..", "..", "etc")), Path.GetFullPath(Path.Combine(baseDirectory, "..", "..", "..", "..", "..", "etc"))), Lifespan.Singleton); container .InitializeDefaultServices() .InitializeDatabaseDrivers(); return(container); }
public void SetUp() { var container = ContainerExtensions.CreateDefaultContainer() .InitializeDefaultServices() .InitializeDatabaseDrivers(); var configuration = new Configuration(container); configuration.Common.AddEventType("FraudWarning", typeof(FraudWarning)); configuration.Common.AddEventType("Withdrawal", typeof(Withdrawal)); configuration.Common.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; _runtime = EPRuntimeProvider.GetRuntime("FraudMonitorTest", configuration); _runtime.EventService.ClockExternal(); _fraudWarningSender = _runtime.EventService.GetEventSender("FraudWarning"); _withdrawalSender = _runtime.EventService.GetEventSender("Withdrawal"); _listener = new SupportUpdateListener(); new FraudMonitor(_runtime, _listener.Update); }