コード例 #1
0
 public void send(EventObject event) throws JSONException {
   ByteBuffer rowKey = se.toByteBuffer(event.getString("partition_on"));
   event.put(timestamp_field, System.currentTimeMillis());
   mutator.addInsertion(
       rowKey, keyspace, createColumn(event.getEventName(), event.toString(), se, se));
   mutator.execute();
 }
コード例 #2
0
 public void doFunction(EventObject e) {
   timestamp(e);
   e.remove("function");
   boolean persisted = false;
   if (e.has(PERSISTED)) {
     try {
       persisted = e.getBoolean(PERSISTED);
     } catch (JSONException e1) {
       // This one we can safely swallow
     }
   }
   if (!persisted) {
     try {
       e.put(PERSISTED, true);
       CEPEventsSendRunnable.handleEventObject(e);
       doSave(e);
     } catch (Exception e3) {
       logger.error("Save of event " + e + " interrupted", e3);
     }
   } else {
     CEPEventsSendRunnable.handleEventObject(e);
   }
 }
コード例 #3
0
 @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);
       }
     }
   }
 }
コード例 #4
0
 public void send(EventObject event, String key) throws JSONException {
   ByteBuffer rowKey = se.toByteBuffer(key);
   event.put(timestamp_field, System.currentTimeMillis());
   mutator.addInsertion(rowKey, "system", createColumn(eventName, event.toString(), se, se));
   mutator.execute();
 }