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


Java EPServiceProviderManager.getDefaultProvider方法代码示例

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


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

示例1: testEsper

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
@Test
public void testEsper() {
    EPServiceProvider engine = EPServiceProviderManager.getDefaultProvider();

    engine.getEPAdministrator().getConfiguration().addEventType(TestEvent.class);

    String query = "select name, age from TestEvent";

    EPStatement statement = engine.getEPAdministrator().createEPL(query);

    statement.addListener((newData, oldData) -> {
        String name = (String) newData[0].get("name");
        int age = (int) newData[0].get("age");
        System.out.println(name + " " + age);
    });

    engine.getEPRuntime().sendEvent(new TestEvent("peter", 10));
}
 
开发者ID:phil3k3,项目名称:flink-esper,代码行数:19,代码来源:EsperTest.java

示例2: main

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

示例3: configure

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
/**
 * This method configures the CEP.
 * 
 * @return It returns a well configured esper service provider instance.
 */
private EPServiceProvider configure() {
	// configure logging
	System.setProperty(DOMImplementationRegistry.PROPERTY,
			"com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
	
	// configure supported event ids
	Configuration config = new Configuration();
	config.addEventTypeAutoName(LogEvent.class.getPackage().getName());
	
	// create provider
	EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);

	// discover schema url
	URL schemaURL = ComplexEventProcessor.class.getClassLoader().getResource(eventLogFile);
	logger.info("xsd path is: " + schemaURL.toString());
	
	// configure default xml stream
	ConfigurationEventTypeXMLDOM sensorcfg = new ConfigurationEventTypeXMLDOM();
	sensorcfg.setRootElementName("log");
	sensorcfg.setSchemaResource(schemaURL.toString());
	epService.getEPAdministrator().getConfiguration()
	    .addEventType(LogEvent.LogEventStream, sensorcfg);
	
	return epService;
}
 
开发者ID:citlab,项目名称:Intercloud,代码行数:31,代码来源:ComplexEventProcessor.java

示例4: testDynamicType

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
/**
 * Play a CSV file using no existing (dynamic) event type (no timestamp)
 */
public void testDynamicType() {
    CSVInputAdapterSpec spec = new CSVInputAdapterSpec(new AdapterInputSource(CSV_FILENAME_ONELINE_TRADE), "TypeB");

    Configuration config = new Configuration();
    config.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();

    InputAdapter feed = new CSVInputAdapter(epService, spec);

    EPStatement stmt = epService.getEPAdministrator().createEPL("select symbol, price, volume from TypeB#length(100)");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    assertEquals(String.class, stmt.getEventType().getPropertyType("symbol"));
    assertEquals(String.class, stmt.getEventType().getPropertyType("price"));
    assertEquals(String.class, stmt.getEventType().getPropertyType("volume"));

    feed.start();
    assertEquals(1, listener.getNewDataList().size());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:TestCSVAdapterUseCases.java

示例5: prepare

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @param map
 * @param tc
 * @param oc
 */
@Override
public void prepare(@SuppressWarnings("rawtypes") Map map, TopologyContext tc, OutputCollector oc) {
    this.collector = oc;
    Configuration cepConfig = new Configuration();
    if (this.eventTypes == null || (this.objectStatements == null && this.statements == null)) {
        throw new FailedException("Event types cannot be null and at least one type of statement has to be not null");
    }
    for (Map.Entry<GlobalStreamId, Grouping> a : tc.getThisSources().entrySet()) {
        Fields f = tc.getComponentOutputFields(a.getKey());
        if (!this.eventTypes.keySet().containsAll(f.toList())) {
            throw new FailedException("Event types and fields from source streams do not match: Event Types="
                    + Arrays.toString(this.eventTypes.keySet().toArray())
                    + " Stream Fields=" + Arrays.toString(f.toList().toArray()));
        }
        cepConfig.addEventType(a.getKey().get_componentId() + "_" + a.getKey().get_streamId(), this.eventTypes);
    }
    this.epService = EPServiceProviderManager.getDefaultProvider(cepConfig);
    this.epService.initialize();
    if (!processStatemens()) {
        throw new FailedException("At least one type of statement has to be not empty");
    }
}
 
开发者ID:miguelantonio,项目名称:storm-esper-bolt,代码行数:30,代码来源:EsperBolt.java

示例6: setMonitoredServer

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
private static void setMonitoredServer(Set<Server> servers, MonitoringServer monitoringServer) {
	monitoringServer.monitoredServers = Maps.newHashMap();
	for (Server server: servers) {
		logger.info("Monitor {}", server.getServerName());
		
		EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider();
		
		server.setSupportMonitoring(true);
		server.setNowMonitoring(ApplicationProperties.getBoolean(server.getServerName() + ".monitoring.autoStart", false));
		server.setMonitoringResult(new MonitoringResultSet());
		server.setEpService(epService);
		
		addEventTypesFromRouter(server);
		createEPLAndAddListener(server);
		
		monitoringServer.monitoredServers.put(server.getServerName(), server);
	}
}
 
开发者ID:be-hase,项目名称:honoumi,代码行数:19,代码来源:MonitoringServer.java

示例7: testIStreamOnly

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
public void testIStreamOnly()
{
    epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();

    EPStatement statement = epService.getEPAdministrator().createEPL(
            "select istream * from " + SupportBean.class.getName() + ".win:length(1)");
    statement.addListener(testListener);

    Object theEvent = sendEvent("a");
    assertSame(theEvent, testListener.assertOneGetNewAndReset().getUnderlying());

    theEvent = sendEvent("b");
    assertSame(theEvent, testListener.getLastNewData()[0].getUnderlying());
    assertNull(testListener.getLastOldData()); // receive no old data, just istream events
    testListener.reset();
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:TestIStreamRStreamKeywords.java

示例8: onBefore

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
@Before
public void onBefore() {
    engine = EPServiceProviderManager.getDefaultProvider();

    engine.getEPAdministrator().getConfiguration().addEventType(BuildSuccess.class);
    engine.getEPAdministrator().getConfiguration().addEventType(BuildFailure.class);

    eventsBuilder = new EventBuilder();
}
 
开发者ID:phil3k3,项目名称:flink-esper,代码行数:10,代码来源:StateChangePatternTest.java

示例9: init

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

示例10: setUp

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
protected void setUp() {
    Configuration configuration = new Configuration();
    configuration.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
    configuration.addImport(FileSourceFactory.class.getName());
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:8,代码来源:TestFileSourceLineGraphs.java

示例11: setUp

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
protected void setUp() {
    Configuration configuration = new Configuration();
    configuration.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
    configuration.addImport(FileSinkFactory.class.getPackage().getName() + ".*");
    configuration.addImport(DefaultSupportSourceOp.class.getName());
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();

    DefaultSupportGraphEventUtil.addTypeConfiguration(epService);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:11,代码来源:TestFileSinkGraphs.java

示例12: setUp

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
public void setUp() {
    // This code runs as part of the automated regression test suite; Therefore disable internal timer theading to safe resources
    Configuration config = new Configuration();
    config.getEngineDefaults().getThreading().setInternalTimerEnabled(false);

    AverageLatencyMonitor.start();
    epService = EPServiceProviderManager.getDefaultProvider(config);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:9,代码来源:TestAverageLatencyAlertMonitor.java

示例13: setUp

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    // This code runs as part of the automated regression test suite; Therefore disable internal timer theading to safe resources
    Configuration config = new Configuration();
    config.getEngineDefaults().getThreading().setInternalTimerEnabled(false);

    listener = new MatchAlertListener();
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();

    new MatchMakingMonitor(epService, listener);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:12,代码来源:TestMatchMakingMonitor.java

示例14: EPServiceMDBAdapter

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
public EPServiceMDBAdapter(OutboundSender outboundSender) {
    Configuration config = new Configuration();
    config.addEventType("Checkin", Checkin.class);
    config.addEventType("Cancelled", Cancelled.class);
    config.addEventType("Completed", Completed.class);
    config.addEventType("Status", Status.class);
    config.addEventType("LowPaper", LowPaper.class);
    config.addEventType("OutOfOrder", OutOfOrder.class);
    config.addEventType("BaseTerminalEvent", BaseTerminalEvent.class);

    // Get engine instance - same engine instance for all MDB instances
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize(); // since this test is running as part of a larger test suite, reset to make sure its a clean engine
    System.out.println(TerminalMDB.class.getName() + "::instance this=" + this.toString() + " engine=" + epService.toString());

    EPStatement statement = null;
    String stmt = null;

    stmt = "select a.term.id as terminal from pattern [ every a=Checkin -> " +
            "      ( OutOfOrder(term.id=a.term.id) and not (Cancelled(term.id=a.term.id) or Completed(term.id=a.term.id)) )]";
    statement = epService.getEPAdministrator().createEPL(stmt);
    statement.addListener(new CheckinProblemListener(outboundSender));

    stmt = "select * from BaseTerminalEvent where type = 'LowPaper' or type = 'OutOfOrder'";
    statement = epService.getEPAdministrator().createEPL(stmt);
    statement.addListener(new TerminalEventListener(outboundSender));

    stmt = "select '1' as terminal, 'terminal is offline' as text from pattern [ every timer:interval(60 seconds) -> (timer:interval(65 seconds) and not Status(term.id = 'T1')) ] output first every 5 minutes";
    statement = epService.getEPAdministrator().createEPL(stmt);
    statement.addListener(new TerminalStatusListener(outboundSender));

    stmt = "insert into CountPerType " +
            "select type, count(*) as countPerType " +
            "from BaseTerminalEvent#time(10 min) " +
            "group by type " +
            "output all every 1 minutes";
    statement = epService.getEPAdministrator().createEPL(stmt);
    statement.addListener(new CountPerTypeListener(outboundSender));
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:40,代码来源:EPServiceMDBAdapter.java

示例15: setup

import com.espertech.esper.client.EPServiceProviderManager; //导入方法依赖的package包/类
public EPServiceProvider setup() {

        Configuration config = new Configuration();
        config.getEngineDefaults().getExecution().setPrioritized(true);
        config.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
        // using Map-event representations by default
        config.getEngineDefaults().getEventMeta().setDefaultEventRepresentation(EventUnderlyingType.MAP);

        EPServiceProvider engine = EPServiceProviderManager.getDefaultProvider(config);
        engine.initialize();

        // Resolve "trivia.epl" file.
        InputStream inputFile = this.getClass().getClassLoader().getResourceAsStream("trivia.epl");
        if (inputFile == null) {
            inputFile = this.getClass().getClassLoader().getResourceAsStream("etc/trivia.epl");
        }
        if (inputFile == null) {
            throw new RuntimeException("Failed to find file 'trivia.epl' in classpath or relative to classpath");
        }

        try {
            engine.getEPAdministrator().getDeploymentAdmin().readDeploy(inputFile, null, null, null);
        } catch (Exception e) {
            throw new RuntimeException("Error deploying EPL from 'trivia.epl': " + e.getMessage(), e);
        }

        return engine;
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:29,代码来源:TriviaExample.java


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