public void run() { runtime.sendEventMap(mapToSend, eventTypeName); } });
public void run() { runtime.sendEventMap(mapToSend, eventTypeName); } });
public void sendEvent(AbstractSendableEvent theEvent, Map mapToSend, String eventTypeName) { runtime.sendEventMap(mapToSend, eventTypeName); }
public void sendEvent(AbstractSendableEvent theEvent, Map mapToSend, String eventTypeName) { runtime.sendEventMap(mapToSend, eventTypeName); }
public void update(long currentTime, Map<String, Object> currentQuestion, int sec, EPEventService runtime) { if (sec == 0) { Map<String, Object> anul = EventFactory.makePlayerAnswer(playerId, currentQuestionId, "A", currentTime); runtime.sendEventMap(anul, "PlayerAnswer"); return; } if (sec == 29) { Map<String, Object> answer = EventFactory.makePlayerAnnulment(playerId, currentQuestionId, currentTime); runtime.sendEventMap(answer, "PlayerAnnulment"); return; } } }
public void update(long currentTime, Map<String, Object> currentQuestion, int sec, EPEventService runtime) { if (sec != 1) { return; } Map<String, Object> answer = EventFactory.makePlayerAnswer(playerId, currentQuestionId, "B", currentTime); runtime.sendEventMap(answer, "PlayerAnswer"); } }
public void update(long currentTime, Map<String, Object> currentQuestion, int sec, EPEventService runtime) { if (sec != 1) { return; } Map<String, Object> answer = EventFactory.makePlayerAnswer(playerId, currentQuestionId, "A", currentTime); runtime.sendEventMap(answer, "PlayerAnswer"); } }
private void sendEvent(String key, int intupd) { Map<String, Object> theEvent = new HashMap<String, Object>(); theEvent.put("uekey", key); theEvent.put("ueint", intupd); runtime.getEventService().sendEventMap(theEvent, "UpdateEvent"); }
public void run() { try { for (Map theEvent : events) { runtime.getEventService().sendEventMap(theEvent, type); } } catch (Throwable t) { lastException = t; t.printStackTrace(); } }
private void sendEvent(String key, int intupd) { Map<String, Object> theEvent = new HashMap<String, Object>(); theEvent.put("key", key); theEvent.put("intupd", intupd); runtime.getEventService().sendEventMap(theEvent, "MyUpdateEvent"); }
public void update(long currentTime, Map<String, Object> currentQuestion, int sec, EPEventService runtime) { if (sec == 0) { Map<String, Object> fa = EventFactory.makePlayerFARequest(playerId, currentQuestionId); runtime.sendEventMap(fa, "PlayerFARequest"); return; } if (sec == 29) { Map<String, Object> answer = EventFactory.makePlayerAnswer(playerId, currentQuestionId, "A", currentTime); runtime.sendEventMap(answer, "PlayerAnswer"); } } }
public void update(long currentTime, Map<String, Object> currentQuestion, int sec, EPEventService runtime) { if (sec != 25) { return; } String answerText = "B"; if (coin) { answerText = "A"; } coin = !coin; Map<String, Object> answer = EventFactory.makePlayerAnswer(playerId, currentQuestionId, answerText, currentTime); runtime.sendEventMap(answer, "PlayerAnswer"); } }
public RegressionEnvironment sendEventMap(Map<String, Object> values, String typeName) { runtime.getEventService().sendEventMap(values, typeName); return this; }
private void handleObject(Object input) { try { if (input instanceof Map) { Map map = (Map) input; String type = (String) map.get("stream"); if (type == null) { log.warn("Expected value for event type not found in map event provided to adapter"); return; } runtime.getEventService().sendEventMap(map, type); } else { runtime.getEventService().sendEventBean(input, input.getClass().getSimpleName()); } } catch (Throwable t) { log.error("Unexpected exception encountered sending event " + input + " service '" + serviceName + "' :" + t.getMessage(), t); } }
private void configureSingleRowFunction() { // Add an event type that has a double-array -type property value compileDeploy("create schema MyMedianSampleEvent(doubles double[primitive])"); // keep the last few events from the variant stream EPStatement stmt = compileDeploy("select mymedian(doubles) as med from MyMedianSampleEvent#lastevent"); // send an event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put("doubles", new double[]{5, 1, 2, 3, 4}); runtime.getEventService().sendEventMap(eventData, "MyMedianSampleEvent"); // print results System.out.println("\nConfigure Single-Row Function:"); System.out.println("Received:" + " med=" + stmt.iterator().next().get("med")); // send a second event eventData = new HashMap<String, Object>(); eventData.put("doubles", new double[]{5, 1, 2, 3, 4, 4}); runtime.getEventService().sendEventMap(eventData, "MyMedianSampleEvent"); // print results System.out.println("Received:" + " med=" + stmt.iterator().next().get("med")); }
private void configureImport() { // Add an event type that has a byte-type property value compileDeploy("create schema MyByteEvent(byteValue byte)"); // keep the last few events from the variant stream EPStatement stmt = compileDeploy("select RuntimeConfigMain.check2BitSet(byteValue) as check2BitSet from MyByteEvent#lastevent"); // send an event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put("byteValue", (byte) 2); runtime.getEventService().sendEventMap(eventData, "MyByteEvent"); // print results System.out.println("\nConfigure Import:"); System.out.println("Received:" + " check2BitSet=" + stmt.iterator().next().get("check2BitSet")); // send a second event eventData = new HashMap<String, Object>(); eventData.put("byteValue", (byte) 1); runtime.getEventService().sendEventMap(eventData, "MyByteEvent"); // print results System.out.println("Received:" + " check2BitSet=" + stmt.iterator().next().get("check2BitSet")); }
private void configureCustomAggregationFunction() { // Add an event type that has a string-type property value compileDeploy("create schema MyConcatSampleEvent(str string)"); // keep the last few events from the variant stream EPStatement stmt = compileDeploy("select concat(str) as cstr from MyConcatSampleEvent"); // send an event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put("str", "part1"); runtime.getEventService().sendEventMap(eventData, "MyConcatSampleEvent"); // print results System.out.println("\nConfigure Aggregation Function:"); System.out.println("Received:" + " cstr=" + stmt.iterator().next().get("cstr")); // send a second event eventData = new HashMap<String, Object>(); eventData.put("str", "part2"); runtime.getEventService().sendEventMap(eventData, "MyConcatSampleEvent"); // print results System.out.println("Received:" + " cstr=" + stmt.iterator().next().get("cstr")); }
private void configureVariables() { compileDeploy("create variable int myintvar = 5"); EPStatement statement = compileDeploy("select propertyOne, propertyTwo, myintvar from MyEvent#lastevent"); // send an event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put("propertyOne", "value"); eventData.put("propertyTwo", 10); runtime.getEventService().sendEventMap(eventData, "MyEvent"); // the statement above keeps the last event for iterating EventBean received = statement.iterator().next(); System.out.println("\nConfigure Variables:"); System.out.println("Received:" + " propertyOne=" + received.get("propertyOne") + " propertyTwo=" + received.get("propertyTwo") + " myintvar=" + received.get("myintvar") ); }
private void configureVariantStream() { compileDeploy("create variant schema MyVariantStream as *"); // keep the last few events from the variant stream EPStatement stmt = compileDeploy("select * from MyVariantStream#time(1 min)"); // insert MyEvent events into the variant stream compileDeploy("insert into MyVariantStream select * from MyEvent"); // Add a second event type compileDeploy("create schema MyOtherEvent (propertyOther string)"); // insert MyOtherEvent events into the variant stream compileDeploy("insert into MyVariantStream select * from MyOtherEvent"); // send some events Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put("propertyOne", "value"); eventData.put("propertyTwo", 10); runtime.getEventService().sendEventMap(eventData, "MyEvent"); eventData = new HashMap<String, Object>(); eventData.put("propertyOther", "test"); runtime.getEventService().sendEventMap(eventData, "MyOtherEvent"); // print results System.out.println("\nConfigure Variant Stream:"); Iterator<EventBean> iterator = stmt.iterator(); EventBean first = iterator.next(); System.out.println("Received (1):" + " propertyOne=" + first.get("propertyOne") + " propertyOther=" + first.get("propertyOther")); EventBean second = iterator.next(); System.out.println("Received (2):" + " propertyOne=" + second.get("propertyOne") + " propertyOther=" + second.get("propertyOther")); }
public void run() { TriviaExample example = new TriviaExample(); EPRuntime runtime = example.setup(); // parse test data List<Round> rounds = parse(TESTDATA); // loop through the rounds for (int i = 0; i < rounds.size(); i++) { Round round = rounds.get(i); System.out.println("\n\nRound " + i); System.out.println("============"); System.out.println(round); // set time setTime(runtime, round.getTime()); // send question event runtime.getEventService().sendEventMap(round.getQuestion(), "TriviaQuestion"); // send player activity for (PlayerAction action : round.getPlayerActions()) { runtime.getEventService().sendEventMap(action.getData(), action.getEventName()); } // trigger score update runtime.getEventService().sendEventMap(EventFactory.makeUpdateScore(round.getQuestionId()), "UpdateScore"); printScore(round.getQuestionId(), TriviaHelper.getScores(runtime)); } runtime.destroy(); }