本文整理汇总了Java中org.wso2.siddhi.core.stream.input.InputHandler.send方法的典型用法代码示例。如果您正苦于以下问题:Java InputHandler.send方法的具体用法?Java InputHandler.send怎么用?Java InputHandler.send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.siddhi.core.stream.input.InputHandler
的用法示例。
在下文中一共展示了InputHandler.send方法的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: testQuery3
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
@Test
public void testQuery3() throws InterruptedException {
log.info("InsertIntoTableTestCase test3");
SiddhiConfiguration configuration = new SiddhiConfiguration();
configuration.setDistributedProcessing(true);
SiddhiManager siddhiManager = new SiddhiManager(configuration);
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();
}
示例3: 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();
}
示例4: testQuery4
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
@Test
public void testQuery4() throws InterruptedException {
log.info("DeleteFromTableTestCase test4 OUT size 3");
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[]{"WSO2", 57.6f, 100l});
Thread.sleep(500);
siddhiManager.shutdown();
}
示例5: 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();
}
示例6: testFilterQuery66
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
@Test
public void testFilterQuery66() throws InterruptedException {
log.info("Filter test66 : NOT Operator");
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[not(volume == 40)] 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();
}
示例7: testFilterQuery65
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
@Test
public void testFilterQuery65() throws InterruptedException {
log.info("Filter test65");
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 == 40 ] 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();
}
示例8: main
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException, SiddhiParserException {
// Create Siddhi Manager
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.defineStream("define stream cseEventStream ( symbol string, price float, volume int )");
siddhiManager.addQuery("from cseEventStream [ price >= 50 ] " +
"select symbol, price "+
"insert into StockQuote ;");
siddhiManager.addCallback("StockQuote", new StreamCallback() {
@Override
public void receive(Event[] events) {
EventPrinter.print(events);
}
});
InputHandler inputHandler = siddhiManager.getInputHandler("cseEventStream");
inputHandler.send(new Object[]{"IBM", 75.6f, 100});
inputHandler.send(new Object[]{"GOOG", 50f, 100});
inputHandler.send(new Object[]{"IBM", 76.6f, 100});
inputHandler.send(new Object[]{"WSO2", 45.6f, 100});
Thread.sleep(500);
siddhiManager.shutdown();
}
示例9: testClusTree2D_27
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
@Test
public void testClusTree2D_27() throws Exception {
logger.info("ClusTreeStreamProcessorExtension Test - Test case to demo separate thread training");
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");
Random random = new Random();
try {
for (int i = 0; i < 1100; i++) {
inputHandler.send(new Object[]{random.nextInt(50), random.nextInt(50)});
inputHandler.send(new Object[]{random.nextInt(50) + 100, random.nextInt(50) + 100});
}
} catch (Exception e) {
logger.error(e.getCause().getMessage());
} finally {
siddhiAppRuntime.shutdown();
}
}
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:35,代码来源:ClusTreeStreamProcessorExtensionTest.java
示例10: testHTTPTextMappingText
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
/**
* Creating test for publishing events with TEXT mapping.
*
* @throws Exception Interrupted exception
*/
@Test (dependsOnMethods = "testHTTPTextMappingJson")
public void testHTTPTextMappingText() throws Exception {
log.info("Creating test for publishing events with TEXT mapping.");
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.setExtension("text-output-mapper", TextSinkMapper.class);
String inStreamDefinition = "Define stream FooStream (message String,method String,headers String);"
+ "@sink(type='http',publisher.url='http://localhost:8005/abc',method='{{method}}',"
+ "headers='{{headers}}',"
+ "@map(type='text', @payload('{{message}}'))) "
+ "Define stream BarStream (message String,method String,headers String);";
String query = ("@info(name = 'query1') " +
"from FooStream select message,method,headers insert into BarStream;");
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition +
query);
InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream");
siddhiAppRuntime.start();
HttpServerListenerHandler lst = new HttpServerListenerHandler(8005);
lst.run();
fooStream.send(new Object[]{"WSO2,55.6,100", "POST", "'Name:John','Age:23'"});
while (!lst.getServerListener().isMessageArrive()) {
Thread.sleep(10);
}
String eventData = lst.getServerListener().getData();
Assert.assertEquals(eventData, "WSO2,55.6,100\n");
Thread.sleep(100);
lst.shutdown();
siddhiAppRuntime.shutdown();
}
示例11: testHTTPTextMappingText2
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
/**
* Creating test for publishing events with TEXT mapping.
*
* @throws Exception Interrupted exception
*/
@Test (dependsOnMethods = "testHTTPTextMappingText")
public void testHTTPTextMappingText2() throws Exception {
log.info("Creating test for publishing events with TEXT mapping.");
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.setExtension("text-output-mapper", TextSinkMapper.class);
String inStreamDefinition = "Define stream FooStream (name String, age int,country" +
" String,method String,headers String);"
+ "@sink(type='http',publisher.url='http://localhost:8005/abc',method='{{method}}',"
+ "headers='{{headers}}',"
+ "@map(type='text')) "
+ "Define stream BarStream (name String, age int,country String,method String,headers String);";
String query = ("@info(name = 'query1') " +
"from FooStream select * insert into BarStream;");
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition +
query);
InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream");
siddhiAppRuntime.start();
HttpServerListenerHandler lst = new HttpServerListenerHandler(8005);
lst.run();
fooStream.send(new Object[]{"WSO2", 55.6, "USA", "POST", "'Name:John','Age:23'"});
while (!lst.getServerListener().isMessageArrive()) {
Thread.sleep(10);
}
String eventData = lst.getServerListener().getData();
Assert.assertEquals(eventData, "name:\"WSO2\",\n" +
"age:55.6,\n" +
"country:\"USA\",\n" +
"method:\"POST\",\n" +
"headers:\"'Name:John','Age:23'\"\n");
lst.shutdown();
siddhiAppRuntime.shutdown();
}
示例12: testHTTPTextMappingText3
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
/**
* Creating test for publishing events with TEXT mapping.
*
* @throws Exception Interrupted exception
*/
@Test (dependsOnMethods = "testHTTPTextMappingText2")
public void testHTTPTextMappingText3() throws Exception {
log.info("Creating test for publishing events with TEXT mapping.");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "Define stream FooStream (message String,method String,headers String);"
+ "@sink(type='http',publisher.url='http://localhost:8005/abc',"
+ "@map(type='text', @payload('{{message}}'))) "
+ "Define stream BarStream (message String,method String,headers String);";
String query = ("@info(name = 'query1') " +
"from FooStream select message,method,headers insert into BarStream;");
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition +
query);
InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream");
siddhiAppRuntime.start();
HttpServerListenerHandler lst = new HttpServerListenerHandler(8005);
lst.run();
fooStream.send(new Object[]{"WSO2,55.6,100", "POST", "'Name:John','Age:23'"});
while (!lst.getServerListener().isMessageArrive()) {
Thread.sleep(10);
}
String eventData = lst.getServerListener().getData();
Assert.assertEquals(eventData, "WSO2,55.6,100\n");
Thread.sleep(100);
lst.shutdown();
siddhiAppRuntime.shutdown();
}
示例13: testHoeffdingClassifierLearningExtension5
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
@Test
public void testHoeffdingClassifierLearningExtension5() throws InterruptedException {
logger.info("HoeffdingClassifierUpdaterStreamProcessorExtension TestCase - Label is of bool type");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 "
+ "double, attribute_3 double, attribute_4 bool );";
String query = ("@info(name = 'query1') from StreamA#streamingml:updateHoeffdingTree('model1', 2, "
+ "attribute_0, attribute_1 , attribute_2 ,attribute_3,attribute_4) select attribute_0, "
+ "attribute_1, attribute_2, attribute_3, accuracy insert into"
+ " outputStream;");
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query);
siddhiAppRuntime.addCallback("query1", new QueryCallback() {
@Override
public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
count.incrementAndGet();
EventPrinter.print(inEvents);
}
});
try {
InputHandler inputHandler = siddhiAppRuntime.getInputHandler("StreamA");
siddhiAppRuntime.start();
inputHandler.send(new Object[]{0.1, 0.8, 0.2, 0.03, true});
inputHandler.send(new Object[]{0.2, 0.95, 0.22, 0.1, true});
inputHandler.send(new Object[]{0.8, 0.1, 0.65, 0.92, false});
inputHandler.send(new Object[]{0.75, 0.1, 0.58, 0.71, false});
SiddhiTestHelper.waitForEvents(200, 4, count, 60000);
} catch (Exception e) {
logger.error(e.getCause().getMessage());
} finally {
siddhiAppRuntime.shutdown();
}
}
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:40,代码来源:HoeffdingClassifierUpdaterStreamProcessorExtensionTestCase.java
示例14: testHTTPTestPutMethod
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
/**
* Creating test for publishing events from PUT method.
* @throws Exception Interrupted exception
*/
@Test (dependsOnMethods = "testHTTPTestGetMethod")
public void testHTTPTestPutMethod() throws Exception {
log.info("Creating test for publishing events from PUT method.");
SiddhiManager siddhiManager = new SiddhiManager();
siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class);
String inStreamDefinition = "Define stream FooStream (message String,method String,headers String);"
+ "@sink(type='http',publisher.url='http://localhost:8005/abc',method='{{method}}',"
+ "headers='{{headers}}',"
+ "@map(type='xml', "
+ "@payload('{{message}}'))) "
+ "Define stream BarStream (message String,method String,headers String);";
String query = ("@info(name = 'query') " +
"from FooStream "
+ "select message,method,headers "
+ "insert into BarStream;"
);
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition +
query);
InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream");
siddhiAppRuntime.start();
HttpServerListenerHandler lst = new HttpServerListenerHandler(8005);
lst.run();
fooStream.send(new Object[]{payload, "PUT", "Name:John,Age:23"});
while (!lst.getServerListener().isMessageArrive()) {
Thread.sleep(10);
}
String eventData = lst.getServerListener().getData();
Assert.assertEquals(expected, eventData);
siddhiAppRuntime.shutdown();
lst.shutdown();
}
示例15: testHTTPTextMappingText4
import org.wso2.siddhi.core.stream.input.InputHandler; //导入方法依赖的package包/类
/**
* Creating test for publishing events with TEXT mapping.
*
* @throws Exception Interrupted exception
*/
@Test (dependsOnMethods = "testHTTPTextMappingText3")
public void testHTTPTextMappingText4() throws Exception {
log.info("Creating test for publishing events with TEXT mapping.");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "Define stream FooStream (message String,method String,headers String);"
+ "@sink(type='http',publisher.url='http://localhost:8005/abc',method='POST',"
+ "headers=\"'Name:John','Age:23'\","
+ "@map(type='text')) "
+ "Define stream BarStream (message String,method String,headers String);";
String query = ("@info(name = 'query1') " +
"from FooStream select message,method,headers insert into BarStream;");
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition +
query);
InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream");
siddhiAppRuntime.start();
HttpServerListenerHandler lst = new HttpServerListenerHandler(8005);
lst.run();
fooStream.send(new Object[]{"WSO2,55.6,100", "POST", "'Name:John','Age:23'"});
while (!lst.getServerListener().isMessageArrive()) {
Thread.sleep(10);
}
String eventData = lst.getServerListener().getData();
Assert.assertEquals(eventData, "message:\"WSO2,55.6,100\",\n" +
"method:\"POST\",\n" +
"headers:\"'Name:John','Age:23'\"\n");
Thread.sleep(100);
lst.shutdown();
siddhiAppRuntime.shutdown();
}