@Test public void testBasicScriptFailure() { RuntimeEngine runtime1 = manager.getRuntimeEngine(ProcessInstanceIdContext.get()); KieSession ksession1 = runtime1.getKieSession(); assertNotNull(ksession1); try { ksession1.startProcess("BrokenScriptTask"); fail("Start process should fail due to broken script"); } catch (Throwable e) { // expected } manager.disposeRuntimeEngine(runtime1); ExecutionErrorManager errorManager = ((AbstractRuntimeManager) manager).getExecutionErrorManager(); ExecutionErrorStorage storage = errorManager.getStorage(); List<ExecutionError> errors = storage.list(0, 10); assertNotNull(errors); assertEquals(1, errors.size()); assertExecutionError(errors.get(0), "Process", "BrokenScriptTask", "Hello"); }
@Override public void handle(Throwable cause) { ExecutionErrorContext errorContext = new ExecutionErrorContext(cause, lastExecutedNode, lastExecutedTask, firstExecutedNode); for (ExecutionErrorFilter filter : filters) { if (filter.accept(errorContext)) { ExecutionError error = filter.filter(errorContext); logger.debug("Filter {} returned {} for {}", filter, error, cause); if (error != null) { try { storage.store(error); logger.debug("Error event {} stored successfully in {}", error, storage); } catch (Throwable e) { logger.warn("Could not persist execution error {} due to {}", error, e.getMessage()); logger.debug("Stack trace ", e); } } else { logger.debug("Filter {} accepted error {} but didn't produce results (error should be ignored)", filter, cause); } return; } } // in case it ended up here - meaning not filters dealt with it, simply log the error logger.error("Unexpected error during processing ", cause); }
ExecutionErrorManager errorManager = manager.getExecutionErrorManager(); errorManager.getStorage().acknowledge("SYSTEM", error.getErrorId()); logger.debug("Error {} has been auto acknowledged by system based on {}", error.getErrorId(), getAckRule()); } else {
ExecutionErrorStorage storage = errorManager.getStorage(); List<ExecutionError> errors = storage.list(0, 10); assertNotNull(errors); assertEquals(1, errors.size());
@Override public void handle(Throwable cause) { ExecutionErrorContext errorContext = new ExecutionErrorContext(cause, lastExecutedNode, lastExecutedTask, firstExecutedNode); for (ExecutionErrorFilter filter : filters) { if (filter.accept(errorContext)) { ExecutionError error = filter.filter(errorContext); logger.debug("Filter {} returned {} for {}", filter, error, cause); if (error != null) { try { storage.store(error); logger.debug("Error event {} stored successfully in {}", error, storage); } catch (Throwable e) { logger.warn("Could not persist execution error {} due to {}", error, e.getMessage()); logger.debug("Stack trace ", e); } } else { logger.debug("Filter {} accepted error {} but didn't produce results (error should be ignored)", filter, cause); } return; } } // in case it ended up here - meaning not filters dealt with it, simply log the error logger.error("Unexpected error during processing ", cause); }
ExecutionErrorStorage storage = errorManager.getStorage(); List<ExecutionError> errors = storage.list(0, 10); assertNotNull(errors); assertEquals(1, errors.size());
ExecutionErrorStorage storage = errorManager.getStorage(); List<ExecutionError> errors = storage.list(0, 10); assertNotNull(errors); assertEquals(1, errors.size());
ExecutionErrorStorage storage = errorManager.getStorage(); List<ExecutionError> errors = storage.list(0, 10); assertNotNull(errors); assertTrue(errors.size() >= expectedErrors);
List<ExecutionError> errors = errorStorage.list(0, 10); assertEquals(0, errors.size()); countDownListener.waitTillCompleted(); errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); assertNotNull(processInstance); errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); countDownListener.waitTillCompleted(); errors = errorStorage.list(0, 10); assertEquals(0, errors.size());
countDownListener.waitTillCompleted(); List<ExecutionError> errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); assertNotNull(processInstance); errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); countDownListener.waitTillCompleted(); errors = errorStorage.list(0, 10); assertEquals(0, errors.size());
countDownListener.waitTillCompleted(); List<ExecutionError> errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); assertNotNull(processInstance); errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); errors = errorStorage.list(0, 10); assertEquals(1, errors.size()); countDownListener.waitTillCompleted(); errors = errorStorage.list(0, 10); assertEquals(0, errors.size());
assertNotNull("ErrorStorage is null", errorStorage); List<ExecutionError> errors = errorStorage.list(0, 10); assertEquals(0, errors.size());
assertNotNull("ErrorStorage is null", errorStorage); List<ExecutionError> errors = errorStorage.list(0, 10); assertEquals(1, errors.size());