当前位置: 首页>>代码示例>>Java>>正文


Java EPServiceProvider.getEPRuntime方法代码示例

本文整理汇总了Java中com.espertech.esper.client.EPServiceProvider.getEPRuntime方法的典型用法代码示例。如果您正苦于以下问题:Java EPServiceProvider.getEPRuntime方法的具体用法?Java EPServiceProvider.getEPRuntime怎么用?Java EPServiceProvider.getEPRuntime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.espertech.esper.client.EPServiceProvider的用法示例。


在下文中一共展示了EPServiceProvider.getEPRuntime方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTimestamp

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的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: AbstractCoordinatedAdapter

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
/**
 * Ctor.
 * @param epService - the EPServiceProvider for the engine runtime and services
 * @param usingEngineThread - true if the Adapter should set time by the scheduling service in the engine,
 *                            false if it should set time externally through the calling thread
 * @param usingExternalTimer - true to use esper's external timer mechanism instead of internal timing
 */
public AbstractCoordinatedAdapter(EPServiceProvider epService, boolean usingEngineThread, boolean usingExternalTimer)
{
	this.usingEngineThread = usingEngineThread;
	this.usingExternalTimer = usingExternalTimer;

	this.setSender(new CustomSender());
	if(epService == null)
	{
		return;
	}
	if(!(epService instanceof EPServiceProviderSPI))
	{
		throw new IllegalArgumentException("Invalid epService provided");
	}
	this.epService = epService;
	this.runtime = epService.getEPRuntime();
	this.schedulingService = ((EPServiceProviderSPI) epService).getSchedulingService();
}
 
开发者ID:curtiszimmerman,项目名称:AlgoTrader,代码行数:26,代码来源:AbstractCoordinatedAdapter.java

示例3: EsperOperation

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
public EsperOperation() {
	Configuration cepConfig = new Configuration();
	cepConfig.addEventType("StockTick", Stock.class.getName());
	EPServiceProvider cep = EPServiceProviderManager.getProvider(
			"myCEPEngine", cepConfig);
	cepRT = cep.getEPRuntime();

	EPAdministrator cepAdm = cep.getEPAdministrator();
	EPStatement cepStatement = cepAdm
			.createEPL("select sum(price),product from "
					+ "StockTick.win:time_batch(5 sec) "
					+ "group by product");

	cepStatement.addListener(new CEPListener());
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Apache-Storm,代码行数:16,代码来源:EsperOperation.java

示例4: testContextQuery

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的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

示例5: runAssertionForceOutputStartEagerSum

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionForceOutputStartEagerSum(EPServiceProvider epService, SupportMarketDataBean[] events) {
    final long startTime = 1000;
    sendTimer(epService, startTime);

    EPStatement stmt = epService.getEPAdministrator().createEPL(
            "select sum(price) from " + SupportMarketDataBean.class.getName() +
                    "#time_length_batch(10 sec, 3, 'force_update, start_eager')");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    EPRuntime engine = epService.getEPRuntime();
    assertFalse(listener.isInvoked());

    sendTimer(epService, startTime + 9999);
    assertFalse(listener.isInvoked());

    // Send batch off
    sendTimer(epService, startTime + 10000);
    assertEquals(null, listener.getLastNewData()[0].get("sum(price)"));
    listener.reset();

    // Send batch off
    sendTimer(epService, startTime + 20000);
    assertEquals(null, listener.getLastNewData()[0].get("sum(price)"));
    listener.reset();

    engine.sendEvent(events[11]);
    engine.sendEvent(events[12]);
    sendTimer(epService, startTime + 30000);
    assertEquals(23.0, listener.getLastNewData()[0].get("sum(price)"));
    listener.reset();

    stmt.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:34,代码来源:ExecViewTimeLengthBatch.java

示例6: runAssertionSum

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionSum(EPServiceProvider epService, SupportMarketDataBean[] events) {
    final long startTime = 1000;
    sendTimer(epService, startTime);
    EPStatement stmt = epService.getEPAdministrator().createEPL(
            "select irstream sum(price) as sumPrice from " + SupportMarketDataBean.class.getName() +
                    "#time_accum(10 sec)");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    EPRuntime engine = epService.getEPRuntime();

    // 1st event
    sendTimer(epService, startTime + 20000);
    engine.sendEvent(events[5]);
    assertData(listener.getLastNewData()[0], 5d);
    assertData(listener.getLastOldData()[0], null);
    listener.reset();

    // 2nd event
    sendTimer(epService, startTime + 25000);
    engine.sendEvent(events[6]);
    assertData(listener.getLastNewData()[0], 11d);
    assertData(listener.getLastOldData()[0], 5d);
    listener.reset();

    sendTimer(epService, startTime + 34999);
    assertFalse(listener.isInvoked());

    sendTimer(epService, startTime + 35000);
    assertData(listener.getLastNewData()[0], null);
    assertData(listener.getLastOldData()[0], 11d);
    listener.reset();

    stmt.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:35,代码来源:ExecViewTimeAccum.java

示例7: sendTimer

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void sendTimer(EPServiceProvider epService, long timeInMSec) {
    CurrentTimeEvent theEvent = new CurrentTimeEvent(timeInMSec);
    EPRuntime runtime = epService.getEPRuntime();
    runtime.sendEvent(theEvent);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:6,代码来源:ExecExprCurrentEvaluationContext.java

示例8: StmtNamedWindowMergeCallable

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
public StmtNamedWindowMergeCallable(EPServiceProvider engine, int numEvents) {
    this.engine = (EPRuntimeSPI) engine.getEPRuntime();
    this.numEvents = numEvents;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:5,代码来源:StmtNamedWindowMergeCallable.java

示例9: StmtNamedWindowQueryCallable

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
public StmtNamedWindowQueryCallable(String threadKey, EPServiceProvider engine, int numRepeats) {
    this.engine = (EPRuntimeSPI) engine.getEPRuntime();
    this.numRepeats = numRepeats;
    this.threadKey = threadKey;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:6,代码来源:StmtNamedWindowQueryCallable.java

示例10: sendTimer

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void sendTimer(long timeInMSec, EPServiceProvider epService) {
    CurrentTimeEvent theEvent = new CurrentTimeEvent(timeInMSec);
    EPRuntime runtime = epService.getEPRuntime();
    runtime.sendEvent(theEvent);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:6,代码来源:ExecPatternGuardTimerWithin.java

示例11: sendEvent

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private SupportBeanTimestamp sendEvent(EPServiceProvider epService, String id, String groupId, long timestamp) {
    SupportBeanTimestamp theEvent = new SupportBeanTimestamp(id, groupId, timestamp);
    EPRuntime runtime = epService.getEPRuntime();
    runtime.sendEvent(theEvent);
    return theEvent;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:ExecViewTimeOrderAndTimeToLive.java

示例12: sendTimer

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void sendTimer(EPServiceProvider epService, long time) {
    CurrentTimeEvent theEvent = new CurrentTimeEvent(time);
    EPRuntime runtime = epService.getEPRuntime();
    runtime.sendEvent(theEvent);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:6,代码来源:ExecViewTimeWindowUnique.java

示例13: runAssertionGroupBySumStartEager

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionGroupBySumStartEager(EPServiceProvider epService) {
    final long startTime = 1000;
    sendTimer(epService, startTime);

    EPRuntime engine = epService.getEPRuntime();
    EPStatement stmt = epService.getEPAdministrator().createEPL(
            "select symbol, sum(price) as s from " + SupportMarketDataBean.class.getName() +
                    "#time_length_batch(5, 10, \"START_EAGER\") group by symbol order by symbol asc");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    sendTimer(epService, startTime + 4000);
    assertFalse(listener.isInvoked());

    sendTimer(epService, startTime + 6000);
    assertEquals(1, listener.getNewDataList().size());
    EventBean[] events = listener.getLastNewData();
    assertNull(events);
    listener.reset();

    sendTimer(epService, startTime + 7000);
    engine.sendEvent(new SupportMarketDataBean("S1", "e1", 10d));

    sendTimer(epService, startTime + 8000);
    engine.sendEvent(new SupportMarketDataBean("S2", "e2", 77d));

    sendTimer(epService, startTime + 9000);
    engine.sendEvent(new SupportMarketDataBean("S1", "e3", 1d));

    sendTimer(epService, startTime + 10000);
    assertFalse(listener.isInvoked());

    sendTimer(epService, startTime + 11000);
    assertEquals(1, listener.getNewDataList().size());
    events = listener.getLastNewData();
    assertEquals(2, events.length);
    assertEquals("S1", events[0].get("symbol"));
    assertEquals(11d, events[0].get("s"));
    assertEquals("S2", events[1].get("symbol"));
    assertEquals(77d, events[1].get("s"));
    listener.reset();

    stmt.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:45,代码来源:ExecViewTimeLengthBatch.java


注:本文中的com.espertech.esper.client.EPServiceProvider.getEPRuntime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。