@Override public void update( EventBean[] newData, EventBean[] oldData, EPStatement statement, EPServiceProvider epServiceProvider) { if (newData != null) { for (int i = 0; i < newData.length; i++) { try { EventObject anEvent = new EventObject(); try { Map<?, ?> aMap = (HashMap<?, ?>) newData[i].getUnderlying(); anEvent = new EventObject(aMap); } catch (Exception e) { for (String name : newData[i].getEventType().getPropertyNames()) { try { anEvent.put(name, newData[i].get(name)); } catch (PropertyAccessException e1) { dsLog.error(e1.getMessage(), e1); } catch (JSONException e1) { dsLog.error(e1.getMessage(), e1); } } } ts = System.currentTimeMillis(); anEvent.put("_query_id", queryID); anEvent.put("_N_ts", ts); anEvent.setEventName(queryID); anEvent.put("_N_id", machineID); anEvent.put("_N_query_id", queryID); try { publisher.publish(anEvent); } catch (IOException e) { dsLog.error(e.getMessage(), e); } } catch (JSONException e) { dsLog.error(e.getMessage(), e); } } } }
public void update(EventBean[] newData, EventBean[] oldData) { System.out.println( "Transaction Id=" + newData[0].get("tid") + ": Latency Between Order Creation and Purchase Order=" + newData[0].get("LatencyAB") + " And Latency between Purchase Order and Shipping=" + newData[0].get("LatencyBC")); String ip = "172.17.76.74"; try { System.out.println("1--->Sending data..."); System.out.println(InetAddress.getByName(ip)); // UdpListener.sendDataOverUdp("TXNCEP.Order.LatencyAB", // newData[0].get("LatencyAB").toString(),InetAddress.getByName(ip),2003); UdpListener.sendDataOverUdp( /*"carbon.txncep.order.latencyab"*/ "carbon.installation.TXNCEP", newData[0].get("LatencyAB").toString(), InetAddress.getByName(ip), 2003); System.out.println("Sending data..."); } catch (SocketException e) { System.out.println("socket error - Socket Exception" + e.getMessage()); System.out.println(); } catch (UnknownHostException e) { System.out.println("socket error - UnknownHost" + e.getMessage()); } catch (PropertyAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }