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


Java InputHandler类代码示例

本文整理汇总了Java中org.wso2.siddhi.core.stream.input.InputHandler的典型用法代码示例。如果您正苦于以下问题:Java InputHandler类的具体用法?Java InputHandler怎么用?Java InputHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testClusTree2D_24

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testClusTree2D_24() throws Exception {
    logger.info("ClusTreeStreamProcessorExtension Test - Test case with non-numeric event data");
    SiddhiManager siddhiManager = new SiddhiManager();
    String inputStream = "define stream InputStream (x double, y double);";

    String query = (
            "@info(name = 'query1') " +
                    "from InputStream#streamingml:clusTree(2, x, y) " +
                    "select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y " +
                    "insert into OutputStream;");
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inputStream + query);

    siddhiAppRuntime.addCallback("query1", new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(inEvents);
        }
    });


    siddhiAppRuntime.start();
    InputHandler inputHandler = siddhiAppRuntime.getInputHandler("InputStream");
    inputHandler.send(new Object[]{5.7905, "hi"});
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:26,代码来源:ClusTreeStreamProcessorExtensionTest.java

示例2: testFilterQuery48

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery48() throws InterruptedException {
    log.info("Filter test48");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume > 50d] select symbol,price insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例3: testFilterQuery92

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery92() throws InterruptedException {
    log.info("Filter test92");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume < 100d] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l, 56});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例4: testFilterQuery78

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery78() throws InterruptedException {
    log.info("Filter test78");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume <= 50] select symbol,price;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例5: testQuery2

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testQuery2() throws InterruptedException {
    log.info("UpdateFromTableTestCase test2");

    SiddhiManager siddhiManager = new SiddhiManager();

    siddhiManager.defineStream("define stream cseEventStream (symbol string, price float, volume long) ");
    siddhiManager.defineStream("define stream cseUpdateEventStream (symbol string, price float, volume long) ");
    siddhiManager.defineTable("define table cseEventTable (symbol string, price float, volume long) ");

    String queryReference = siddhiManager.addQuery("from cseEventStream " +
                                                   "insert into cseEventTable;");

    siddhiManager.addQuery("from cseUpdateEventStream " +
                           "update cseEventTable" +
                           "    on cseEventTable.symbol=='IBM';");
    InputHandler cseEventStream = siddhiManager.getInputHandler("cseEventStream");
    cseEventStream.send(new Object[]{"WSO2", 55.6f, 100l});
    cseEventStream.send(new Object[]{"IBM", 75.6f, 100l});
    cseEventStream.send(new Object[]{"WSO2", 57.6f, 100l});
    InputHandler cseUpdateEventStream = siddhiManager.getInputHandler("cseUpdateEventStream");
    cseUpdateEventStream.send(new Object[]{"GOOG", 10f, 100l});
    Thread.sleep(500);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:27,代码来源:UpdateFromTableTestCase.java

示例6: testQuery3

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testQuery3() throws InterruptedException {
    log.info("InsertIntoTableTestCase test3");

    SiddhiManager siddhiManager = new SiddhiManager();

    siddhiManager.defineStream("define stream cseEventStream (symbol string, price float, volume long) ");
    siddhiManager.defineStream("define stream cseEventStream2 (symbol string, price float, volume long) ");
    siddhiManager.defineTable("define table cseEventTable (symbol string, price float, volume long) ");
    siddhiManager.defineTable("define table cseEventTable2 (symbol string, price float, volume long) ");

    String queryReference = siddhiManager.addQuery("from cseEventStream " +
                                                   "insert into cseEventTable;");
    siddhiManager.addQuery("from cseEventStream2 " +
                           "insert into cseEventTable2;");

    InputHandler cseEventStream = siddhiManager.getInputHandler("cseEventStream");
    cseEventStream.send(new Object[]{"WSO2", 55.6f, 100l});
    cseEventStream.send(new Object[]{"IBM", 75.6f, 100l});
    cseEventStream.send(new Object[]{"WSO2", 57.6f, 100l});
    Thread.sleep(500);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:InsertIntoTableTestCase.java

示例7: testFilterQuery34

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery34() throws InterruptedException {
    log.info("Filter test34");

    SiddhiManager siddhiManager = new SiddhiManager();

    InputHandler inputHandler = siddhiManager.defineStream("define stream cseEventStream (symbol string, price double, volume int)");
    String queryReference = siddhiManager.addQuery("from cseEventStream[price != 50 ] select symbol,price,volume insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 50});
    inputHandler.send(new Object[]{"IBM", 55d, 100});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:FilterTestCase.java

示例8: testFilterQuery50

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery50() throws InterruptedException {
    log.info("Filter test50");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume == 60d ] select symbol,price insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例9: testFilterQuery107

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery107() throws InterruptedException {
    log.info("Filter test107");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume >= 100f] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l, 56});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例10: testFilterQuery35

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery35() throws InterruptedException {
    log.info("Filter test35");

    SiddhiManager siddhiManager = new SiddhiManager();

    InputHandler inputHandler = siddhiManager.defineStream("define stream cseEventStream (symbol string, price double, volume int)");
    String queryReference = siddhiManager.addQuery("from cseEventStream[price != 50f ] select symbol,price,volume insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 50});
    inputHandler.send(new Object[]{"IBM", 55d, 100});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:FilterTestCase.java

示例11: testQuery1

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testQuery1() throws InterruptedException {
    log.info("InsertIntoTableTestCase test1");

    SiddhiManager siddhiManager = new SiddhiManager();

    siddhiManager.defineStream("define stream cseEventStream (symbol string, price float, volume long) ");
    siddhiManager.defineTable("define table cseEventTable (symbol string, price float, volume long) ");

    String queryReference = siddhiManager.addQuery("from cseEventStream " +
                                                   "insert into cseEventTable;");

    InputHandler cseEventStream = siddhiManager.getInputHandler("cseEventStream");
    cseEventStream.send(new Object[]{"WSO2", 55.6f, 100l});
    cseEventStream.send(new Object[]{"IBM", 75.6f, 100l});
    cseEventStream.send(new Object[]{"WSO2", 57.6f, 100l});
    Thread.sleep(500);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:21,代码来源:InsertIntoTableTestCase.java

示例12: testQuery6

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testQuery6() throws InterruptedException {
    log.info("DeleteFromTableTestCase test6 OUT size 0");

    SiddhiManager siddhiManager = new SiddhiManager();

    siddhiManager.defineStream("define stream cseEventStream (symbol string, price float, volume long) ");
    siddhiManager.defineStream("define stream cseDeleteEventStream (symbol string, price float, volume long) ");
    siddhiManager.defineTable("define table cseEventTable (symbol string, price float, volume long) ");

    String queryReference = siddhiManager.addQuery("from cseEventStream " +
                                                   "insert into cseEventTable;");

    siddhiManager.addQuery("from cseDeleteEventStream " +
                           "delete cseEventTable " +
                           "    on symbol=='IBM';");
    InputHandler cseEventStream = siddhiManager.getInputHandler("cseEventStream");
    InputHandler cseDeleteEventStream = siddhiManager.getInputHandler("cseDeleteEventStream");
    cseEventStream.send(new Object[]{"WSO2", 55.6f, 100l});
    cseEventStream.send(new Object[]{"IBM", 75.6f, 100l});
    cseEventStream.send(new Object[]{"WSO2", 57.6f, 100l});
    cseDeleteEventStream.send(new Object[]{"IBM", 57.6f, 100l});
    Thread.sleep(500);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:27,代码来源:DeleteFromTableTestCase.java

示例13: testFilterQuery55

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery55() throws InterruptedException {
    log.info("Filter test55");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[price == 50f ] select symbol,price insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例14: testFilterQuery63

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery63() throws InterruptedException {
    log.info("Filter test63");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume == 40d ] select symbol,price insert into outputStream;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例15: testFilterQuery106

import org.wso2.siddhi.core.stream.input.InputHandler; //导入依赖的package包/类
@Test
public void testFilterQuery106() throws InterruptedException {
    log.info("Filter test106");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume >= 100d] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l, 56});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java


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