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


Java Configuration.addPluginLoader方法代码示例

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


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

示例1: getEngineWKafkaOutput

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public static EPServiceProvider getEngineWKafkaOutput(String uri, Properties pluginProperties) {
    Configuration engineConfig = new Configuration();
    engineConfig.addImport(KafkaOutputDefault.class);
    engineConfig.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
    engineConfig.addPluginLoader(EsperIOKafkaOutputAdapterPlugin.class.getSimpleName(), EsperIOKafkaOutputAdapterPlugin.class.getName(), pluginProperties, null);
    return EPServiceProviderManager.getProvider(uri, engineConfig);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:8,代码来源:SupportConstants.java

示例2: runAssertionAdapterLoader

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
private void runAssertionAdapterLoader() throws Exception {
    SupportPluginLoader.reset();
    // Assure destroy order ESPER-489

    Properties props = new Properties();
    props.put("name", "val");
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addPluginLoader("MyLoader", SupportPluginLoader.class.getName(), props);

    props = new Properties();
    props.put("name2", "val2");
    config.addPluginLoader("MyLoader2", SupportPluginLoader.class.getName(), props);

    EPServiceProvider service = EPServiceProviderManager.getProvider("ExecClientAdapterLoader", config);
    assertEquals(2, SupportPluginLoader.getNames().size());
    assertEquals(2, SupportPluginLoader.getPostInitializes().size());
    assertEquals("MyLoader", SupportPluginLoader.getNames().get(0));
    assertEquals("MyLoader2", SupportPluginLoader.getNames().get(1));
    assertEquals("val", SupportPluginLoader.getProps().get(0).get("name"));
    assertEquals("val2", SupportPluginLoader.getProps().get(1).get("name2"));

    Object loader = service.getContext().getEnvironment().get("plugin-loader/MyLoader");
    assertTrue(loader instanceof SupportPluginLoader);
    loader = service.getContext().getEnvironment().get("plugin-loader/MyLoader2");
    assertTrue(loader instanceof SupportPluginLoader);

    SupportPluginLoader.getPostInitializes().clear();
    SupportPluginLoader.getNames().clear();
    service.initialize();
    assertEquals(2, SupportPluginLoader.getPostInitializes().size());
    assertEquals(2, SupportPluginLoader.getNames().size());

    service.destroy();
    assertEquals(2, SupportPluginLoader.getDestroys().size());
    assertEquals("val2", SupportPluginLoader.getDestroys().get(0).get("name2"));
    assertEquals("val", SupportPluginLoader.getDestroys().get(1).get("name"));
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:38,代码来源:ExecClientAdapterLoader.java

示例3: runAssertionDestroyObtainTwice

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
private void runAssertionDestroyObtainTwice() {
    SupportPluginLoader.reset();

    Configuration cf = SupportConfigFactory.getConfiguration();
    cf.addPluginLoader("AP", SupportPluginLoader.class.getName(), null);
    EPServiceProviderManager.getProvider("ExecClientAdapterLoader", cf);
    EPServiceProvider ep = EPServiceProviderManager.getProvider("ExecClientAdapterLoader");
    ep.destroy();
    assertEquals(1, SupportPluginLoader.getDestroys().size());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:11,代码来源:ExecClientAdapterLoader.java

示例4: validateGet

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
private void validateGet(boolean isNio, int port, String engineURI) throws Exception {

        String esperIOHTTPConfig = "<esperio-http-configuration>\n" +
                "<service name=\"service1\" port=\"" + port + "\" nio=\"" + isNio + "\"/>" +
                "<get service=\"service1\" pattern=\"*\"/>" +
                "</esperio-http-configuration>";

        Configuration engineConfig = new Configuration();
        engineConfig.addPluginLoader("EsperIOHTTPAdapter", EsperIOHTTPAdapterPlugin.class.getName(), new Properties(), esperIOHTTPConfig);

        engineConfig.addEventType("SupportBean", SupportBean.class);

        EPServiceProvider provider = EPServiceProviderManager.getProvider(engineURI, engineConfig);

        EPStatement stmt = provider.getEPAdministrator().createEPL("select * from SupportBean");
        stmt.addListener(listener);

        SupportHTTPClient client = new SupportHTTPClient(port);
        String[] fields = "stringProp,intProp".split(",");
        client.request(port, "sendevent", "stream", "SupportBean", "stringProp", "abc", "intProp", "5");
        EPAssertionUtil.assertProps(listener.assertOneGetNew(), fields, new Object[]{"abc", 5});

        listener.reset();
        provider.destroy();

        try {
            client = new SupportHTTPClient(port);
            client.request(port, "sendevent");
            fail();
        } catch (Exception expected) {
        }
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:33,代码来源:TestHTTPAdapterInput.java

示例5: getEngineWKafkaInput

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public static EPServiceProvider getEngineWKafkaInput(String uri, Properties pluginProperties) {
    Configuration engineConfig = new Configuration();
    engineConfig.getEngineDefaults().getThreading().setInternalTimerEnabled(false);
    engineConfig.addPluginLoader(EsperIOKafkaInputAdapterPlugin.class.getSimpleName(), EsperIOKafkaInputAdapterPlugin.class.getName(), pluginProperties, null);
    return EPServiceProviderManager.getProvider(uri, engineConfig);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:SupportConstants.java

示例6: testDML

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void testDML() throws InterruptedException, SQLException, NamingException {
    String esperIODBConfig = "<esperio-db-configuration>\n" +
            "<jdbc-connection name=\"db1\">\n" +
            "<drivermanager-connection class-name=\"com.mysql.jdbc.Driver\" url=\"jdbc:mysql://localhost/test\" user=\"root\" password=\"password\"/>\n" +
            "<connection-settings auto-commit=\"true\" catalog=\"TEST\"/>" +
            "</jdbc-connection>\n" +
            "<dml connection=\"db1\" stream=\"SupportDBBean\" name=\"MyInsertQuery\" retry=\"10\" retry-interval-sec=\"0.1\">\n" +
            "<sql>insert into mytestupsert(key1, key2, value1, value2)\n" +
            "values (?, ?, ?, ?)</sql>\n" +
            "<bindings>\n" +
            "<parameter pos=\"1\" property=\"key1\"/>\n" +
            "<parameter pos=\"2\" property=\"key2\"/>\n" +
            "<parameter pos=\"3\" property=\"value1\"/>\n" +
            "<parameter pos=\"4\" property=\"value2\"/>\n" +
            "</bindings>\n" +
            "</dml>\n" +
            "</esperio-db-configuration>";

    Configuration engineConfig = new Configuration();
    engineConfig.addPluginLoader("EsperIODBAdapter", EsperIODBAdapterPlugin.class.getName(), new Properties(), esperIODBConfig);

    engineConfig.addEventType("SupportDBBean", SupportDBBean.class);
    engineConfig.addEventType("SupportBean", SupportBean.class);

    EPServiceProvider provider = EPServiceProviderManager.getProvider(ENGINE_URI, engineConfig);

    provider.getEPAdministrator().createEPL("insert into SupportDBBean select 'A' as key1, intProp as key2, stringProp as value1, intProp as value2 from SupportBean");
    provider.getEPRuntime().sendEvent(new SupportBean("a", 10));

    Object[][] rows = SupportDatabaseService.readAll(TABLE_NAME);
    EPAssertionUtil.assertEqualsExactOrder(rows, new Object[][]{{"A", 10, "a", 10.0d}});

    provider.getEPRuntime().sendEvent(new SupportBean("b", 15));
    rows = SupportDatabaseService.readAll(TABLE_NAME);
    EPAssertionUtil.assertEqualsExactOrder(rows, new Object[][]{{"A", 10, "a", 10.0d}, {"A", 15, "b", 15.0d}});

    // look up executor services
    Context context = provider.getContext();
    ExecutorServices result = (ExecutorServices) context.lookup("EsperIODBAdapter/ExecutorServices");
    assertNotNull(result);

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

示例7: testSendObject

import com.espertech.esper.client.Configuration; //导入方法依赖的package包/类
public void testSendObject() throws Exception {
    int port = 6800;
    String mapTypeName = "MyMapType";

    String esperIOConfig = "<esperio-socket-configuration>\n" +
            "<socket name=\"service1\" port=\"" + port + "\" data=\"object\"/>" +
            "</esperio-socket-configuration>";

    Configuration engineConfig = new Configuration();
    engineConfig.addPluginLoader("EsperIOSocketAdapter", EsperIOSocketAdapterPlugin.class.getName(), new Properties(), esperIOConfig);

    engineConfig.addEventType("SupportBean", SupportBean.class);
    engineConfig.addEventType(mapTypeName, getMapType());

    EPServiceProvider provider = EPServiceProviderManager.getProvider("SocketAdapterTest", engineConfig);

    EPStatement stmt = provider.getEPAdministrator().createEPL("select * from SupportBean");
    stmt.addListener(listener);

    stmt = provider.getEPAdministrator().createEPL("select * from " + mapTypeName);
    stmt.addListener(listener);

    SupportSocketUtil.sendSingleObject(port, new SupportBean("E1", 10));
    String[] fields = "stringProp,intProp".split(",");
    Thread.sleep(200);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E1", 10});

    SupportSocketClientObject client = new SupportSocketClientObject(port);
    client.send(new SupportBean("E2", 20));
    Thread.sleep(200);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E2", 20});

    client.send(new SupportBean("E3", 30));
    Thread.sleep(200);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E3", 30});

    client.close();

    SupportSocketClientObject clientOne = new SupportSocketClientObject(port);
    SupportSocketClientObject clientTwo = new SupportSocketClientObject(port);

    clientTwo.send(new SupportBean("E4", 40));
    Thread.sleep(200);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E4", 40});

    clientOne.send(new SupportBean("E5", 50));
    Thread.sleep(200);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E5", 50});

    clientOne.send(getMapEvent(mapTypeName, "E6", 60));
    Thread.sleep(200);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E6", 60});

    clientOne.close();
    clientTwo.close();
    provider.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:58,代码来源:TestSocketAdapterObject.java


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