本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}