private static Map<String, Object> toMap(EventBean bean) { HashMap<String, Object> res = new HashMap<String, Object>(); for (String attribute : bean.getEventType().getPropertyNames()) { res.put(attribute, bean.get(attribute)); } return res; } }
@Override public void update(EventBean[] newEvents, EventBean[] oldEvents) { // TODO register esper callback which sends email -> how to specify what to look for in the event ? if (newEvents != null) { for (EventBean newEvent : newEvents) { Double result1 = (Double) newEvent.get("result1"); if (result1 != null) { createAndSendAlertEmail(String.format("Boo ! Result " + result1)); } } } }
private static Map<String, Object> toMap(final EventBean bean) { final HashMap<String, Object> res = new HashMap<String, Object>(); for (final String attribute : bean.getEventType().getPropertyNames()) { res.put(attribute, bean.get(attribute)); } return res; } }
private List<Object> toTuple(EventBean event, Fields fields) { int numFields = fields.size(); List<Object> tuple = new ArrayList<Object>(numFields); for (int idx = 0; idx < numFields; idx++) { tuple.add(event.get(fields.get(idx))); } return tuple; }
@Override public void update(EventBean[] newEvents, EventBean[] oldEvents) { if (newEvents != null) { for (EventBean newEvent : newEvents) { for (String attribute : newEvent.getEventType().getPropertyNames()) { add(attribute, new DateTime(DateTimeZone.UTC), newEvent.get(attribute)); } } } }
@Transformer public Object unpackThroughputCalculationFromEsperBeanArray(EventBean[] eventBeans) throws ThroughputCalculationException { if (eventBeans.length > 0) { Object throughputCalculation = eventBeans[0].get(throughputCalculationKey); return throughputCalculation; } throw new ThroughputCalculationException( "Could not find specified throughput calculation property in event beans"); } }
@Override public void update(EventBean[] newEvents, EventBean[] oldEvents) { if (newEvents != null) { for (EventBean newEvent : newEvents) { for (String attribute : newEvent.getEventType().getPropertyNames()) { publisher.send(config.getPrefix() + "." + attribute, newEvent.get(attribute)); } } } } }
Object obj = newEvents[i].get("value"); DebugListener.logger.debug("\t\tvalue: " + obj);
/** * Given an Event form the Esper core engine, get its timestamp * * @param newEvent Event to extract its timestamp from * @param configTimeAttribute time attribute in the publisher configuration, can be null * @return the event timestamp */ public static Long getEventMillis(EventBean newEvent, String configTimeAttribute) { Long timeInMs = null; if (configTimeAttribute != null) { EventPropertyDescriptor desc = newEvent.getEventType().getPropertyDescriptor(configTimeAttribute); if (desc != null) { Object value = newEvent.get(configTimeAttribute); if (value != null) { timeInMs = Long.parseLong(value.toString()); } } } if (timeInMs == null) { timeInMs = System.currentTimeMillis(); } return timeInMs; } }
try { Object obj = this.bean.get(propertyName);
@Override public void update(EventBean[] newEvents, EventBean[] oldEvents) { if (newEvents != null) { for (EventBean newEvent : newEvents) { for (String attribute : newEvent.getEventType().getPropertyNames()) { Object value = newEvent.get(attribute); if (value != null) { publisher.send(config.getPrefix() + "." + attribute, value); } } } } } }
Object value = newEvent.get(attribute);
Object value = newEvent.get(attribute);
@Override public void update(EventBean[] newEvents, EventBean[] oldEvents) { if (newEvents != null) { for (EventBean newEvent : newEvents) { String typeName = getEventName(newEvent); Long timeInMs = getEventMillis(newEvent, config.getTimeAttribute()); for (String attribute : newEvent.getEventType().getPropertyNames()) { String fullName = (typeName == null ? attribute : typeName + "." + attribute); if (config.isIncluded(fullName)) { Object value = newEvent.get(attribute); if (value != null) { publisher.send(config.getPrefix() + "." + attribute, timeInMs, value); } } } } } } }