This content has been marked as final.
Show 1 reply
-
1. Re: SAM's simulation API
heiko.braun Jul 3, 2008 4:50 PM (in response to heiko.braun)Javadocs will follow. But to give you an idea here's an example taken from a unit test:
// config Properties config = new Properties(); config.put(EventSimulation.TOTAL_SIM_TIME, 60.00); // init EventSimulation simulation = EventSimulation.bootstrap( config, Thread.currentThread().getContextClassLoader().getResource("simulation/esper-cfg.xml") ); // shared between all entities SimulationContext context = simulation.getContext(); // create an event source and associate a message factory EventSourceEntity source = new EventSourceEntity("source-A", 0.10); source.setEventMessageFactory( new SensorMessageFactory() ); // create an event sink EventSinkEntity sink = new EventSinkEntity("sensor-events-viz"); sink.setEventHandler( new ChartGenerationHandler() ); simulation.addSource(source); simulation.addSink(sink); // bind statements to test simulation.bindStatement("select * from SensorEventMessage.win:length_batch(10)", sink); // start simulation simulation.singleRun();