@Override public void process(Event event) { numRecords.mark(); Timer.Context timerContext = mappingTimer.time(); try { Record record = new Record(); for (Entry<String, String> entry : event.getHeaders().entrySet()) { record.put(entry.getKey(), entry.getValue()); } byte[] bytes = event.getBody(); if (bytes != null && bytes.length > 0) { record.put(Fields.ATTACHMENT_BODY, bytes); } try { Notifications.notifyStartSession(morphline); if (!morphline.process(record)) { numFailedRecords.mark(); LOG.warn("Morphline {} failed to process record: {}", morphlineFileAndId, record); } } catch (RuntimeException t) { numExceptionRecords.mark(); morphlineContext.getExceptionHandler().handleException(t, record); } } finally { timerContext.stop(); } }
private static Pipe getPipe(Command p) { while (!(p instanceof Pipe)) { p = p.getParent(); } Preconditions.checkNotNull(p); return (Pipe) p; }
@Override public boolean process(Record record) { Preconditions.checkNotNull(record); return child.process(record); }
private static Pipe getPipe(Command p) { while (!(p instanceof Pipe)) { p = p.getParent(); } Preconditions.checkNotNull(p); return (Pipe) p; }
@Override public boolean process(Record record) { Preconditions.checkNotNull(record); return child.process(record); }
@Override public void notify(Record notification) { Preconditions.checkNotNull(notification); Preconditions.checkNotNull(parent); Preconditions.checkNotNull(child); if (!ignoreNotifications) { child.notify(notification); } }
@Override public void notify(Record notification) { Preconditions.checkNotNull(notification); Preconditions.checkNotNull(parent); Preconditions.checkNotNull(child); if (!ignoreNotifications) { child.notify(notification); } }
@Override protected void doNotify(Record notification) { for (Command childRule : childRules) { if (!catchExceptions) { childRule.notify(notification); } else { try { childRule.notify(notification); } catch (RuntimeException e) { numExceptionsCaught.mark(); LOG.warn("tryRules command caught rule exception in doNotify(). Continuing to try other remaining rules", e); // continue and try the other remaining rules } } } super.doNotify(notification); }
/** * Processes the given record on the data plane of this command. * * @return true to indicate that processing shall continue, false to indicate that backtracking * shall be done */ protected boolean doProcess(Record record) { return getChild().process(record); }
/** * Processes the given notification on the control plane of the subtree rooted at this command. */ protected void doNotify(Record notification) { getChild().notify(notification); }
/** * Processes the given record on the data plane of this command. * * @return true to indicate that processing shall continue, false to indicate that backtracking * shall be done */ protected boolean doProcess(Record record) { return getChild().process(record); }
/** * Processes the given notification on the control plane of the subtree rooted at this command. */ protected void doNotify(Record notification) { getChild().notify(notification); }
@Override protected boolean doProcess(Record record) { return !realChild.process(record) && super.doProcess(record); }
@Override protected void doNotify(Record notification) { for (Command childRule : childRules) { if (!catchExceptions) { childRule.notify(notification); } else { try { childRule.notify(notification); } catch (RuntimeException e) { numExceptionsCaught.mark(); LOG.warn("tryRules command caught rule exception in doNotify(). Continuing to try other remaining rules", e); // continue and try the other remaining rules } } } super.doNotify(notification); }
@Override protected boolean doProcess(Record record) { return !realChild.process(record) && super.doProcess(record); }
@Override protected void doNotify(Record notification) { realChild.notify(notification); super.doNotify(notification); }