new ExpressionEvaluatingTransactionSynchronizationProcessor(); processor.setBeforeCommitExpression(this.PARSER.parseExpression(this.beforeCommitExpression)); processor.setAfterCommitExpression(this.PARSER.parseExpression(this.afterCommitExpression)); processor.setAfterRollbackExpression(this.PARSER.parseExpression(this.afterRollbackExpression)); processor.setBeforeCommitChannel(this.beforeCommitChannel); processor.setAfterCommitChannel(this.afterCommitChannel); processor.setAfterRollbackChannel(this.afterRollbackChannel);
@Override protected void onInit() { super.onInit(); if (this.evaluationContext == null) { this.evaluationContext = createEvaluationContext(); } }
@Override public void processBeforeCommit(IntegrationResourceHolder holder) { doProcess(holder, this.beforeCommitExpression, this.beforeCommitChannel, "beforeCommit"); }
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); ExpressionEvaluatingTransactionSynchronizationProcessor syncProcessor = new ExpressionEvaluatingTransactionSynchronizationProcessor(); syncProcessor.setBeanFactory(mock(BeanFactory.class)); syncProcessor.setBeforeCommitExpression(new SpelExpressionParser().parseExpression("#bix")); syncProcessor.setBeforeCommitChannel(queueChannel); syncProcessor.setAfterCommitChannel(queueChannel); syncProcessor.setAfterCommitExpression(new SpelExpressionParser().parseExpression("#baz"));
new ExpressionEvaluatingTransactionSynchronizationProcessor(); syncProcessor.setBeanFactory(mock(BeanFactory.class)); syncProcessor.setAfterRollbackChannel(queueChannel); syncProcessor.setAfterRollbackExpression(new SpelExpressionParser().parseExpression("#baz"));
protected StandardEvaluationContext createEvaluationContext() { return ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); ExpressionEvaluatingTransactionSynchronizationProcessor syncProcessor = new ExpressionEvaluatingTransactionSynchronizationProcessor(); syncProcessor.setBeanFactory(mock(BeanFactory.class)); PollableChannel queueChannel = new QueueChannel(); syncProcessor.setBeforeCommitExpression(new SpelExpressionParser().parseExpression("#bix")); syncProcessor.setBeforeCommitChannel(queueChannel); syncProcessor.setAfterCommitExpression(new SpelExpressionParser().parseExpression("#baz"));
new ExpressionEvaluatingTransactionSynchronizationProcessor(); syncProcessor.setBeanFactory(mock(BeanFactory.class)); syncProcessor.setAfterRollbackChannel(queueChannel); syncProcessor.setAfterRollbackExpression(new SpelExpressionParser().parseExpression("#baz"));
protected StandardEvaluationContext createEvaluationContext() { return ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }
new ExpressionEvaluatingTransactionSynchronizationProcessor(); processor.setBeforeCommitExpression(this.PARSER.parseExpression(this.beforeCommitExpression)); processor.setAfterCommitExpression(this.PARSER.parseExpression(this.afterCommitExpression)); processor.setAfterRollbackExpression(this.PARSER.parseExpression(this.afterRollbackExpression)); processor.setBeforeCommitChannel(this.beforeCommitChannel); processor.setAfterCommitChannel(this.afterCommitChannel); processor.setAfterRollbackChannel(this.afterRollbackChannel);
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); ExpressionEvaluatingTransactionSynchronizationProcessor syncProcessor = new ExpressionEvaluatingTransactionSynchronizationProcessor(); syncProcessor.setBeanFactory(mock(BeanFactory.class)); PollableChannel queueChannel = new QueueChannel(); syncProcessor.setAfterRollbackChannel(queueChannel); syncProcessor.setAfterRollbackExpression(new SpelExpressionParser().parseExpression("#baz"));
@Override public void processAfterRollback(IntegrationResourceHolder holder) { doProcess(holder, this.afterRollbackExpression, this.afterRollbackChannel, "afterRollback"); }
/** * If we don't need variables (i.e., resource is null) * we can use a singleton context; otherwise we need a new one each time. * @param resource The resource * @return The context. */ private EvaluationContext prepareEvaluationContextToUse(Object resource) { if (resource != null) { EvaluationContext evaluationContextWithVariables = createEvaluationContext(); if (resource instanceof IntegrationResourceHolder) { IntegrationResourceHolder holder = (IntegrationResourceHolder) resource; for (Entry<String, Object> entry : holder.getAttributes().entrySet()) { String key = entry.getKey(); evaluationContextWithVariables.setVariable(key, entry.getValue()); } } return evaluationContextWithVariables; } else { return this.evaluationContext; } }
@Override public void processAfterCommit(IntegrationResourceHolder holder) { doProcess(holder, this.afterCommitExpression, this.afterCommitChannel, "afterCommit"); }
@Override protected void onInit() { super.onInit(); if (this.evaluationContext == null) { this.evaluationContext = createEvaluationContext(); } }
@Override public void processAfterCommit(IntegrationResourceHolder holder) { doProcess(holder, this.afterCommitExpression, this.afterCommitChannel, "afterCommit"); }
/** * If we don't need variables (i.e., resource is null) * we can use a singleton context; otherwise we need a new one each time. * @param resource The resource * @return The context. */ private EvaluationContext prepareEvaluationContextToUse(Object resource) { if (resource != null) { EvaluationContext evaluationContextWithVariables = createEvaluationContext(); if (resource instanceof IntegrationResourceHolder) { IntegrationResourceHolder holder = (IntegrationResourceHolder) resource; for (Entry<String, Object> entry : holder.getAttributes().entrySet()) { String key = entry.getKey(); evaluationContextWithVariables.setVariable(key, entry.getValue()); } } return evaluationContextWithVariables; } else { return this.evaluationContext; } }
@Override public void processAfterRollback(IntegrationResourceHolder holder) { doProcess(holder, this.afterRollbackExpression, this.afterRollbackChannel, "afterRollback"); }
@Override public void processBeforeCommit(IntegrationResourceHolder holder) { doProcess(holder, this.beforeCommitExpression, this.beforeCommitChannel, "beforeCommit"); }