@Override public void commitTransaction() { Notifications.notifyCommitTransaction(morphline); }
@Override public void rollbackTransaction() { Notifications.notifyRollbackTransaction(morphline); }
@Override public void beginTransaction() { Notifications.notifyBeginTransaction(morphline); }
FaultTolerance faultTolerance = new FaultTolerance( context.getBoolean(FaultTolerance.IS_PRODUCTION_MODE, false), context.getBoolean(FaultTolerance.IS_IGNORING_RECOVERABLE_EXCEPTIONS, false), morphline = new Compiler().compile( new File(morphlineFile), morphlineId, morphlineContext, finalChild, override);
@Override protected void doNotify(Record notification) { if (Notifications.containsLifecycleEvent(notification, Notifications.LifecycleEvent.START_SESSION)) { recordCounter = 0; // reset } super.doNotify(notification); }
@Override public final void notify(Record notification) { beforeNotify(notification); doNotify(notification); }
/** Helper that checks if the user provided configuration parameters are valid. */ protected void validateArguments() { getConfigs().validateArguments(getConfig()); }
@Override public void stop() { Notifications.notifyShutdown(morphline); }
@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(); } }
@Override public void notify(Record notification) { if (Notifications.containsLifecycleEvent(notification, Notifications.LifecycleEvent.START_SESSION)) { numStartEvents++; } }
/** * Notify the given command that a transaction has begun. * @param command The {@link Command} to be notified. */ public static void notifyBeginTransaction(Command command) { notify(command, LifecycleEvent.BEGIN_TRANSACTION); }
public FaultTolerance(boolean isProductionMode, boolean isIgnoringRecoverableExceptions, String recoverableExceptionClassNames) { this.isProductionMode = isProductionMode; this.isIgnoringRecoverableExceptions = isIgnoringRecoverableExceptions; this.clazzes = parseRecoverableExceptionClassNames(recoverableExceptionClassNames); }
@Override protected void doNotify(Record notification) { if (Notifications.containsLifecycleEvent(notification, Notifications.LifecycleEvent.START_SESSION)) { recordCounter = 0; // reset } super.doNotify(notification); }
@Override public final void notify(Record notification) { beforeNotify(notification); doNotify(notification); }
/** Helper that checks if the user provided configuration parameters are valid. */ protected void validateArguments() { getConfigs().validateArguments(getConfig()); }
/** * Notify the given command that a transaction has been rolled back. * @param command The {@link Command} to be notified. */ public static void notifyRollbackTransaction(Command command) { notify(command, LifecycleEvent.ROLLBACK_TRANSACTION); }
@Override protected void doNotify(Record notification) { if (Notifications.containsLifecycleEvent(notification, Notifications.LifecycleEvent.START_SESSION)) { recordCounter = 0; // reset } super.doNotify(notification); }
/** * Notify the given command that a shutdown command has been issued. * @param command The {@link Command} to be notified. */ public static void notifyShutdown(Command command) { notify(command, LifecycleEvent.SHUTDOWN); }
/** * Notify the given command that a transaction has been committed. * @param command The {@link Command} to be notified. */ public static void notifyCommitTransaction(Command command) { notify(command, LifecycleEvent.COMMIT_TRANSACTION); }
/** * Notify the given command that a shutdown command has been issued. * @param command The {@link Command} to be notified. */ public static void notifyShutdown(Command command) { notify(command, LifecycleEvent.SHUTDOWN); }