本文整理汇总了Java中com.espertech.esper.client.time.CurrentTimeEvent类的典型用法代码示例。如果您正苦于以下问题:Java CurrentTimeEvent类的具体用法?Java CurrentTimeEvent怎么用?Java CurrentTimeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CurrentTimeEvent类属于com.espertech.esper.client.time包,在下文中一共展示了CurrentTimeEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testTimestamp
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
@Test
public void testTimestamp() {
final Configuration cepConfig = new Configuration();
cepConfig.addEventType("Event", EapEvent.class.getName());
final EPServiceProvider cep = EPServiceProviderManager.getProvider("myCEPEngine", cepConfig);
final EPRuntime cepRT = cep.getEPRuntime();
final EPAdministrator cepAdm = cep.getEPAdministrator();
// create statement
final EPStatement timeStatement = cepAdm.createEPL("select count(*) from Event.win:time(1 hour)");
timeStatement.addListener(new CEPListener());
// create events
final List<EapEvent> ratingEvents = this.createRatingEvents();
this.sortEventListByDate(ratingEvents);
// pass events to Esper engine
for (final EapEvent event : ratingEvents) {
cepRT.sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_EXTERNAL));
// System.out.println(new
// CurrentTimeEvent(event.getTimestamp().getTime()).toString());
cepRT.sendEvent(new CurrentTimeEvent(event.getTimestamp().getTime()));
cepRT.sendEvent(event);
}
}
开发者ID:bptlab,项目名称:Unicorn,代码行数:26,代码来源:StatementTest.java
示例2: tryAssertion
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void tryAssertion(EPServiceProvider epService) {
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
SupportUpdateListener listenerOne = new SupportUpdateListener();
String[] fields = "c0,c1".split(",");
EPStatement statementOne = epService.getEPAdministrator().createEPL("context NestedContext " +
"select theString as c0, sum(intPrimitive) as c1 from SupportBean \n" +
"output last when terminated");
statementOne.addListener(listenerOne);
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(10000));
EPAssertionUtil.assertPropsPerRow(listenerOne.getDataListsFlattened(), fields,
new Object[][]{{"E1", 1}, {"E2", 2}}, null);
listenerOne.reset();
epService.getEPRuntime().sendEvent(new SupportBean("E1", 3));
epService.getEPRuntime().sendEvent(new SupportBean("E3", 4));
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(20000));
EPAssertionUtil.assertPropsPerRow(listenerOne.getDataListsFlattened(), fields,
new Object[][]{{"E1", 3}, {"E3", 4}}, null);
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ExecContextNested.java
示例3: setUp
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
public void setUp() {
Configuration configuration = new Configuration();
configuration.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
configuration.addEventType("MarketDataEvent", MarketDataEvent.class.getName());
epService = EPServiceProviderManager.getProvider("TestTicksPerSecondStatement", configuration);
epService.initialize();
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
new TicksPerSecondStatement(epService.getEPAdministrator());
TicksFalloffStatement stmt = new TicksFalloffStatement(epService.getEPAdministrator());
listener = new SupportUpdateListener();
stmt.addListener(listener);
// Use external clocking for the test
epService.getEPRuntime().sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_EXTERNAL));
}
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:TestTicksFalloffStatement.java
示例4: test1PReceiveFAQ
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
public void test1PReceiveFAQ() throws Exception {
// send Q + A
engine.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
engine.getEPRuntime().sendEvent(EventFactory.makeTriviaQuestion("Q1", "What clock never ticks?", "The un-clog", 0), "TriviaQuestion");
engine.getEPRuntime().sendEvent(EventFactory.makePlayerAnswer("P1", "Q1", "peter pan", System.currentTimeMillis()), "PlayerAnswer");
// send FA request, assert response
engine.getEPRuntime().sendEvent(EventFactory.makePlayerFARequest("P2", "Q1"), "PlayerFARequest");
// send answer
engine.getEPRuntime().sendEvent(EventFactory.makePlayerAnswer("P2", "Q1", "The un-clog", System.currentTimeMillis()), "PlayerAnswer");
engine.getEPRuntime().sendEvent(new CurrentTimeEvent(35000));
engine.getEPRuntime().sendEvent(EventFactory.makeUpdateScore("Q1"), "UpdateScore");
assertScore("P1", -1);
assertScore("P2", 1);
}
开发者ID:espertechinc,项目名称:esper,代码行数:19,代码来源:TestTriviaCases.java
示例5: run
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
public void run() {
long time = 1000;
long numAdvances = 0;
try {
while (latch.get() && (maxNumAdvances == -1 || numAdvances < maxNumAdvances)) {
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(time));
numAdvances++;
time += 1000;
try {
Thread.sleep(threadSleepTime);
} catch (InterruptedException e) {
}
}
} catch (RuntimeException ex) {
ex.printStackTrace();
}
}
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecMTContextInitiatedTerminatedWithNowParallel.java
示例6: runAssertionMethodAggRateUnbound
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionMethodAggRateUnbound(EPServiceProvider epService) {
EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("I1");
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
String[] fields = "c0".split(",");
String epl = "select rate(1, filter:theString like 'A%') as c0 from SupportBean";
EPStatement stmt = isolated.getEPAdministrator().createEPL(epl, "stmt1", null);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
sendEventAssert(isolated, listener, "X1", 0, fields, new Object[]{null});
sendEventAssert(isolated, listener, "A1", 1, fields, new Object[]{null});
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(1000));
sendEventAssert(isolated, listener, "X2", 2, fields, new Object[]{null});
sendEventAssert(isolated, listener, "A2", 2, fields, new Object[]{1.0});
sendEventAssert(isolated, listener, "A3", 3, fields, new Object[]{2.0});
stmt.destroy();
isolated.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecAggregateFilterNamedParameter.java
示例7: runAssertionWithTime
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionWithTime(EPServiceProvider epService, long startTime, long flipTime) {
EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("isolated");
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime));
String text = "select * from SupportBean " +
"match_recognize (" +
" measures A as a" +
" pattern (A*)" +
" interval 10 seconds" +
")";
EPStatement stmt = isolated.getEPAdministrator().createEPL(text, "s0", null);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
isolated.getEPRuntime().sendEvent(new SupportBean("E1", 1));
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
assertFalse(listener.getIsInvokedAndReset());
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
assertTrue(listener.getIsInvokedAndReset());
isolated.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ExecRowRecogIntervalMicrosecondResolution.java
示例8: runAssertionSelfJoin
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionSelfJoin(EPServiceProvider epService) {
// ESPER-528
epService.getEPAdministrator().createEPL(EventRepresentationChoice.MAP.getAnnotationText() + " create schema Product (product string, productsize int)");
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
String query =
" @Hint('reclaim_group_aged=1,reclaim_group_freq=1') select Product.product as product, Product.productsize as productsize from Product unidirectional" +
" left outer join Product#time(3 seconds)#groupwin(product,productsize)#size PrevProduct on Product.product=PrevProduct.product and Product.productsize=PrevProduct.productsize" +
" having PrevProduct.size<2";
epService.getEPAdministrator().createEPL(query);
// Set to larger number of executions and monitor memory
for (int i = 0; i < 10; i++) {
sendProductNew(epService, "The id of this product is deliberately very very long so that we can use up more memory per instance of this event sent into Esper " + i, i);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(i * 100));
//if (i % 2000 == 0) {
// System.out.println("i=" + i + "; Allocated: " + Runtime.getRuntime().totalMemory() / 1024 / 1024 + "; Free: " + Runtime.getRuntime().freeMemory() / 1024 / 1024);
//}
}
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecViewGroupWin.java
示例9: runAssertionOutputEveryTimePeriod
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionOutputEveryTimePeriod(EPServiceProvider epService) {
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(2000));
String stmtText = "select symbol from MarketData#keepall output snapshot every 1 day 2 hours 3 minutes 4 seconds 5 milliseconds";
EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
sendMDEvent(epService, "E1", 0);
long deltaSec = 26 * 60 * 60 + 3 * 60 + 4;
long deltaMSec = deltaSec * 1000 + 5 + 2000;
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(deltaMSec - 1));
assertFalse(listener.isInvoked());
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(deltaMSec));
assertEquals("E1", listener.assertOneGetNewAndReset().get("symbol"));
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:20,代码来源:ExecOutputLimitSimple.java
示例10: runAssertionMeasurePresence
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionMeasurePresence(EPServiceProvider engine, long baseTime, String select, Object value) {
engine.getEPRuntime().sendEvent(new CurrentTimeEvent(baseTime));
String epl = "select * from SupportBean " +
"match_recognize (" +
" measures A as a, A.theString as id, " + select + " as val " +
" pattern (A B*) " +
" interval 1 minute " +
" define " +
" A as (A.intPrimitive=1)," +
" B as (B.intPrimitive=2))";
SupportUpdateListener listener = new SupportUpdateListener();
engine.getEPAdministrator().createEPL(epl).addListener(listener);
engine.getEPRuntime().sendEvent(new SupportBean("E1", 1));
engine.getEPRuntime().sendEvent(new SupportBean("E2", 2));
engine.getEPRuntime().sendEvent(new CurrentTimeSpanEvent(baseTime + 60 * 1000 * 2));
assertEquals(value, listener.getNewDataListFlattened()[0].get("val"));
engine.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecRowRecogClausePresence.java
示例11: runAssertionStartZeroInitiatedNow
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionStartZeroInitiatedNow(EPServiceProvider epService) {
String[] fieldsOne = "c0,c1".split(",");
// test start-after with immediate start
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
String contextExpr = "create context CtxPerId start after 0 sec end after 60 sec";
epService.getEPAdministrator().createEPL(contextExpr);
EPStatement stream = epService.getEPAdministrator().createEPL("context CtxPerId select theString as c0, intPrimitive as c1 from SupportBean");
SupportUpdateListener listener = new SupportUpdateListener();
stream.addListener(listener);
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fieldsOne, new Object[]{"E1", 1});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(59999));
epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fieldsOne, new Object[]{"E2", 2});
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(60000));
epService.getEPRuntime().sendEvent(new SupportBean("E3", 3));
assertFalse(listener.getAndClearIsInvoked());
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecContextInitTerm.java
示例12: tryAssertionPatternUniOuterJoinNoOn
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void tryAssertionPatternUniOuterJoinNoOn(EPServiceProvider epService, SupportUpdateListener listener, long startTime) {
String[] fields = "c0,c1".split(",");
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime + 2000));
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{null, 1L});
epService.getEPRuntime().sendEvent(new SupportBean("E1", 10));
assertFalse(listener.isInvoked());
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime + 3000));
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{10, 1L});
epService.getEPRuntime().sendEvent(new SupportBean("E2", 11));
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime + 4000));
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{21, 2L});
epService.getEPRuntime().sendEvent(new SupportBean("E3", 12));
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime + 5000));
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{33, 3L});
}
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecJoinUnidirectionalStream.java
示例13: runAssertionExpressionBatch
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionExpressionBatch(EPServiceProvider epService) throws Exception {
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
String epl = "@Name('create_var') create variable long ENGINE_TIME;\n" +
"@Name('engine_time_update') on pattern[every timer:interval(10 seconds)] set ENGINE_TIME = current_timestamp();\n" +
"@Name('out_null') select window(*) from SupportBean#groupwin(theString)#expr_batch(oldest_timestamp.plus(9 seconds) < ENGINE_TIME);";
epService.getEPAdministrator().getDeploymentAdmin().parseDeploy(epl);
SupportUpdateListener listener = new SupportUpdateListener();
epService.getEPAdministrator().getStatement("out_null").addListener(listener);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(5000));
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(10000));
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(11000));
assertFalse(listener.isInvoked());
}
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecViewGroupWin.java
示例14: run
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
public void run(EPServiceProvider defaultEPService) throws Exception {
assertNoEngineJMX();
Configuration configuration = SupportConfigFactory.getConfiguration();
configuration.getEngineDefaults().getMetricsReporting().setJmxEngineMetrics(true);
EPServiceProvider epService = EPServiceProviderManager.getProvider(ENGINE_NAME, configuration);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(DateTime.parseDefaultMSec("2002-05-1T08:00:00.000")));
epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
epService.getEPAdministrator().createEPL("select * from pattern [every a=SupportBean(theString like 'A%') -> b=SupportBean(theString like 'B') where timer:within(a.intPrimitive)]");
epService.getEPRuntime().sendEvent(new SupportBean("A1", 10));
epService.getEPRuntime().sendEvent(new SupportBean("A2", 60));
assertEngineJMX();
epService.destroy();
assertNoEngineJMX();
}
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:ExecClientEPServiceProviderMetricsJMX.java
示例15: runAssertionOrAndNotAndZeroStart
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionOrAndNotAndZeroStart(EPServiceProvider epService) {
epService.getEPAdministrator().getConfiguration().addEventType("A", SupportBean_A.class.getName());
epService.getEPAdministrator().getConfiguration().addEventType("B", SupportBean_B.class.getName());
epService.getEPAdministrator().getConfiguration().addEventType("C", SupportBean_C.class.getName());
tryOrAndNot(epService, "(a=A -> b=B) or (a=A -> not b=B)");
tryOrAndNot(epService, "a=A -> (b=B or not B)");
// try zero-time start
SupportUpdateListener listener = new SupportUpdateListener();
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
epService.getEPAdministrator().createEPL("select * from pattern [timer:interval(0) or every timer:interval(1 min)]").addListenerWithReplay(listener);
assertTrue(listener.isInvoked());
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:17,代码来源:ExecPatternOperatorOr.java
示例16: runAssertionPattern
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionPattern(EPServiceProvider epService, long startTime, String patternExpr, long... flipTimes) {
EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("iso");
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime));
SupportUpdateListener listener = new SupportUpdateListener();
EPStatement stmt = isolated.getEPAdministrator().createEPL("select * from pattern[" + patternExpr + "]", "s0", null);
stmt.addListener(listener);
int count = 0;
for (long flipTime : flipTimes) {
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
assertFalse("Failed for flip " + count, listener.getAndClearIsInvoked());
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
assertTrue("Failed for flip " + count, listener.getAndClearIsInvoked());
count++;
}
isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(Long.MAX_VALUE));
assertFalse(listener.getAndClearIsInvoked());
isolated.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecPatternMicrosecondResolution.java
示例17: getServiceProvider
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private EPServiceProvider getServiceProvider(String context) throws IOException {
EPServiceProvider serviceProvider = engineState.value();
if (serviceProvider != null) {
return serviceProvider;
}
synchronized (lock) {
serviceProvider = engineState.value();
if (serviceProvider == null) {
Configuration configuration = new Configuration();
configuration.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
serviceProvider = EPServiceProviderManager.getProvider(context, configuration);
serviceProvider.getEPAdministrator().getConfiguration().addEventType(inputType.getTypeClass());
serviceProvider.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
EPStatement statement = query.createStatement(serviceProvider.getEPAdministrator());
statement.addListener((newData, oldData) -> {
for (EventBean event : newData) {
EsperSelectFunction<OUT> userFunction = getUserFunction();
try {
output.collect(new StreamRecord<>((userFunction.select(event))));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
this.engineState.update(serviceProvider);
return serviceProvider;
} else {
return engineState.value();
}
}
}
开发者ID:phil3k3,项目名称:flink-esper,代码行数:34,代码来源:SelectEsperStreamOperator.java
示例18: testContextQuery
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
@Test
public void testContextQuery() {
final Configuration cepConfig = new Configuration();
cepConfig.addEventType("Event", EapEvent.class.getName());
final EPServiceProvider cep = EPServiceProviderManager.getProvider("myCEPEngine", cepConfig);
final EPRuntime cepRT = cep.getEPRuntime();
final EPAdministrator cepAdm = cep.getEPAdministrator();
cepAdm.createEPL("" + "CREATE CONTEXT NestedContext " + "CONTEXT SegmentedByLocation PARTITION BY values('Location') FROM Event, " + "CONTEXT SegmentedByTime INITIATED BY Event(values('Action')='Ende') TERMINATED AFTER 1 hour, " + "CONTEXT SegmentedByRating PARTITION BY values('Rating') FROM Event");
final EPStatement transformationStatement = cepAdm.createEPL("" + "CONTEXT NestedContext " + "SELECT ID, values('Location'), values('Rating'), count(*) " + "FROM Event " + "GROUP BY values('Location'), values('Rating') " + "OUTPUT LAST EVERY 30 minute");
transformationStatement.addListener(new CEPListener());
final List<EapEvent> events = new ArrayList<EapEvent>();
events.addAll(this.createRatingEvents());
events.addAll(this.createKinoEvents());
this.sortEventListByDate(events);
for (final EapEvent event : events) {
cepRT.sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_EXTERNAL));
cepRT.sendEvent(new CurrentTimeEvent(event.getTimestamp().getTime()));
cepRT.sendEvent(event);
}
cepRT.sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_INTERNAL));
}
开发者ID:bptlab,项目名称:Unicorn,代码行数:29,代码来源:StatementTest.java
示例19: runAssertionJoinRemoveStream
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
private void runAssertionJoinRemoveStream(EPServiceProvider epService) {
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
epService.getEPAdministrator().getConfiguration().addEventType(WebEvent.class);
String stmtContext = "create context SegmentedBySession partition by sessionId from WebEvent";
epService.getEPAdministrator().createEPL(stmtContext);
String epl = " context SegmentedBySession " +
" select rstream A.pageName as pageNameA , A.sessionId as sessionIdA, B.pageName as pageNameB, C.pageName as pageNameC from " +
"WebEvent(pageName='Start')#time(30) A " +
"full outer join " +
"WebEvent(pageName='Middle')#time(30) B on A.sessionId = B.sessionId " +
"full outer join " +
"WebEvent(pageName='End')#time(30) C on A.sessionId = C.sessionId " +
"where A.pageName is not null and (B.pageName is null or C.pageName is null) ";
EPStatement statement = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
statement.addListener(listener);
// Set up statement for finding missing events
sendWebEventsComplete(epService, 0);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(20000));
sendWebEventsComplete(epService, 1);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(40000));
assertFalse(listener.isInvoked());
sendWebEventsComplete(epService, 2);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(60000));
sendWebEventsIncomplete(epService, 3);
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(80000));
assertFalse(listener.isInvoked());
epService.getEPRuntime().sendEvent(new CurrentTimeEvent(100000));
assertTrue(listener.isInvoked());
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:37,代码来源:ExecContextPartitioned.java
示例20: sendEvent
import com.espertech.esper.client.time.CurrentTimeEvent; //导入依赖的package包/类
public void sendEvent(Object theEvent) throws EPException {
if (theEvent == null) {
log.error(".sendEvent Null object supplied");
return;
}
if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) {
if ((!(theEvent instanceof CurrentTimeEvent)) || (ExecutionPathDebugLog.isTimerDebugEnabled)) {
log.debug(".sendEvent Processing event " + theEvent);
}
}
// Process event
processEvent(theEvent);
}
开发者ID:espertechinc,项目名称:esper,代码行数:16,代码来源:EPRuntimeIsolatedImpl.java
注:本文中的com.espertech.esper.client.time.CurrentTimeEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论