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


Java Configuration.addEventType方法代码示例

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


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

示例1: main

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	Configuration config = new Configuration();
	//config.addEventType("BasicEvent", BasicEvent.class);
	config.addEventType("PerfEvent", PerfEvent.class);

	/* If we gonna use custom timestamps - use this
	ConfigurationEventTypeLegacy cetl = new  ConfigurationEventTypeLegacy();
	cetl.setStartTimestampPropertyName("timestamp");
	cetl.setEndTimestampPropertyName("timestamp");
	config.addEventType("PerfEvent", PerfEvent.class.getName(), cetl);
	*/
	// Get engine instance
	EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);

	String stmt = "insert into OpsEvent select ciId, 'cpu' as name, 'open' as state, 'count:' || cast(count(1),string) as cnt from PerfEvent.win:time(1 min) where metrics('cpu') > 10 group by ciId having count(1) > 0 output first every 3 minutes";
	
	EPStatement statement = epService.getEPAdministrator().createEPL(stmt, "test");
	assertTrue(statement != null);		

}
 
开发者ID:oneops,项目名称:oneops,代码行数:24,代码来源:StmtTest.java

示例2: testTimestamp

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

示例3: init

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
/**
 * Initalizes the Sensor
 *
 * @param instanceId instance id where the sensor running
 * @param poolSize   sensor poolsize value
 * @throws Exception throws if any error while initializing sensor.
 */
public void init(int instanceId, int poolSize) throws Exception {
    long start = System.currentTimeMillis();
    logger.info(">>> Sensor initialization started.");

    this.instanceId = instanceId - 1;
    this.poolSize = poolSize;

    Configuration cfg = new Configuration();
    cfg.addEventType("PerfEvent", PerfEvent.class.getName());
    cfg.addEventType("DelayedPerfEvent", DelayedPerfEvent.class.getName());
    cfg.addEventType("OpsEvent", OpsEvent.class.getName());
    cfg.addEventType("OpsCloseEvent", OpsCloseEvent.class.getName());
    cfg.addEventType("ChannelDownEvent", ChannelDownEvent.class.getName());

    ConfigurationEngineDefaults.Threading ct = cfg.getEngineDefaults().getThreading();
    ct.setThreadPoolInbound(true);
    ct.setThreadPoolInboundNumThreads(ESPER_INBOUND_THREADS);
    ct.setThreadPoolOutbound(true);
    ct.setThreadPoolOutboundNumThreads(ESPER_OUTBOUND_THREADS);
    ct.setThreadPoolRouteExec(true);
    ct.setThreadPoolRouteExecNumThreads(ESPER_ROUTE_EXEC_THREADS);
    ct.setThreadPoolTimerExec(true);
    ct.setThreadPoolTimerExecNumThreads(ESPER_TIMER_THREADS);

    this.epService = EPServiceProviderManager.getDefaultProvider(cfg);
    loadAllStatements();
    this.isInited = true;

    long tt = TimeUnit.SECONDS.convert((System.currentTimeMillis() - start), TimeUnit.MILLISECONDS);
    logger.info(">>> Sensor initialization completed. Took " + tt + " seconds!!!");
}
 
开发者ID:oneops,项目名称:oneops,代码行数:39,代码来源:Sensor.java

示例4: EsperOperation

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

示例5: testContextQuery

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

示例6: makeConfig

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
private Configuration makeConfig(String typeName, boolean useBean) {
    Configuration configuration = new Configuration();
    configuration.addImport(FileSourceCSV.class.getPackage().getName() + ".*");
    if (useBean) {
        configuration.addEventType(typeName, ExampleMarketDataBean.class);
    } else {
        Map<String, Object> eventProperties = new HashMap<String, Object>();
        eventProperties.put("symbol", String.class);
        eventProperties.put("price", double.class);
        eventProperties.put("volume", Integer.class);
        configuration.addEventType(typeName, eventProperties);
    }

    return configuration;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:16,代码来源:TestCSVAdapterUseCases.java

示例7: run

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void run() {

        Configuration configuration = new Configuration();
        configuration.addEventType("PriceLimit", PriceLimit.class.getName());
        configuration.addEventType("StockTick", StockTick.class.getName());

        log.info("Setting up EPL");
        EPServiceProvider epService = EPServiceProviderManager.getProvider(engineURI, configuration);
        epService.initialize();
        new StockTickerMonitor(epService, new StockTickerResultListener());

        log.info("Generating test events: 1 million ticks, ratio 2 hits, 100 stocks");
        StockTickerEventGenerator generator = new StockTickerEventGenerator();
        LinkedList stream = generator.makeEventStream(1000000, 500000, 100, 25, 30, 48, 52, false);
        log.info("Generating " + stream.size() + " events");

        log.info("Sending " + stream.size() + " limit and tick events");
        for (Object theEvent : stream) {
            epService.getEPRuntime().sendEvent(theEvent);

            if (continuousSimulation) {
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    log.debug("Interrupted", e);
                    break;
                }
            }
        }

        log.info("Done.");
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:33,代码来源:StockTickerMain.java

示例8: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_A", SupportBean_A.class);
    configuration.getEngineDefaults().getViewResources().setShareViews(false);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:6,代码来源:ExecClientIsolationUnitConfig.java

示例9: run

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void run(String engineURI)
{
    log.info("Setting up EPL");

    Configuration config = new Configuration();
    config.getEngineDefaults().getThreading().setInternalTimerEnabled(false);   // external timer for testing
    config.addEventType("OHLCTick", OHLCTick.class);
    config.addPlugInView("examples", "ohlcbarminute", OHLCBarPlugInViewFactory.class.getName());

    EPServiceProvider epService = EPServiceProviderManager.getProvider(engineURI, config);
    epService.initialize();     // Since running in a unit test may use the same engine many times

    // set time as an arbitrary start time
    sendTimer(epService, toTime("9:01:50"));

    Object[][] statements = new Object[][] {
        {"S1",    "select * from OHLCTick.std:groupwin(ticker).examples:ohlcbarminute(timestamp, price)"},
        };

    for (Object[] statement : statements)
    {
        String stmtName = (String) statement[0];
        String expression = (String) statement[1];
        log.info("Creating statement: " + expression);
        EPStatement stmt = epService.getEPAdministrator().createEPL(expression, stmtName);

        if (stmtName.equals("S1"))
        {
            OHLCUpdateListener listener = new OHLCUpdateListener();
            stmt.addListener(listener);
        }
    }

    log.info("Sending test events");

    Object[][] input = new Object[][] {
            {"9:01:51", null},  // lets start simulating at 9:01:51
            {"9:01:52", "IBM", 100.5, "9:01:52"},  // lets have an event arrive on time
            {"9:02:03", "IBM", 100.0, "9:02:03"},
            {"9:02:10", "IBM",  99.0, "9:02:04"},  // lets have an event arrive later; this timer event also triggers a bucket
            {"9:02:20", "IBM",  98.0, "9:02:16"},
            {"9:02:30", "NOC",  11.0, "9:02:30"},
            {"9:02:45", "NOC",  12.0, "9:02:45"},
            {"9:02:55", "NOC",  13.0, "9:02:55"},
            {"9:03:02", "IBM", 101.0, "9:02:58"},   // this event arrives late but counts in the same bucket
            {"9:03:06", "IBM", 109.0, "9:02:59"},   // this event arrives too late: it should be ignored (5 second cutoff time, see view)
            {"9:03:07", "IBM", 103.0, "9:03:00"},   // this event should count for the next bucket
            {"9:03:55", "NOC",  12.5, "9:03:55"},
            {"9:03:58", "NOC",  12.75, "9:03:58"},
            {"9:04:00", "IBM", 104.0, "9:03:59"},
            {"9:04:02", "IBM", 105.0, "9:04:00"},   // next bucket starts with this event
            {"9:04:07", null},   // should complete next bucket even though there is no event arriving
            {"9:04:30", null},   // pretend no events
            {"9:04:59", null},
            {"9:05:00", null},
            {"9:05:10", null},
            {"9:05:15", "IBM", 105.5, "9:05:13"},
            {"9:05:59", null},
            {"9:06:07", null},
    };

    for (int i = 0; i < input.length; i++)
    {
        String timestampArrival = (String) input[i][0];
        log.info("Sending timer event " + timestampArrival);
        sendTimer(epService, toTime(timestampArrival));

        String ticker = (String) input[i][1];
        if (ticker != null)
        {
            double price = ((Number) input[i][2]).doubleValue();
            String timestampTick = (String) input[i][3];
            OHLCTick event = new OHLCTick(ticker, price, toTime(timestampTick));

            log.info("Sending event " + event);
            epService.getEPRuntime().sendEvent(event);
        }
    }
}
 
开发者ID:curtiszimmerman,项目名称:AlgoTrader,代码行数:80,代码来源:OHLCMain.java

示例10: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.addEventType("SupportDateTime", SupportDateTime.class);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:4,代码来源:ExecDTToDateCalMSec.java

示例11: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.addEventType("SupportEvent", SupportTradeEvent.class);
    configuration.getEngineDefaults().getExecution().setThreadingProfile(ConfigurationEngineDefaults.ThreadingProfile.LARGE);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:5,代码来源:ExecFilterLargeThreading.java

示例12: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.getEngineDefaults().getViewResources().setShareViews(false);
    configuration.getEngineDefaults().getExecution().setAllowIsolatedService(true);
    configuration.addEventType(SupportBean.class);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:6,代码来源:ExecPatternObserverTimerSchedule.java

示例13: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:ExecContextPartitionedNamedWindow.java

示例14: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.addEventType("Bean", SupportBean_Container.class);
    configuration.addEventType("SupportCollection", SupportCollection.class);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:5,代码来源:ExecEnumAverage.java

示例15: configure

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void configure(Configuration configuration) throws Exception {
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_ST0", SupportBean_ST0.class);
    configuration.addEventType("SupportBean_ST1", SupportBean_ST1.class);
    configuration.getEngineDefaults().getLogging().setAuditPattern("[%u] [%s] [%c] %m");
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:ExecClientAudit.java


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