public class ExpressionEvaluatingTransactionSynchronizationProcessor extends IntegrationObjectSupport implements TransactionSynchronizationProcessor, IntegrationEvaluationContextAware
TransactionSynchronizationFactory
allows you to configure SpEL expressions, with their execution being coordinated
(synchronized) with a transaction - see TransactionSynchronization
.
Expressions for before-commit
, after-commit
, and after-rollback
are supported, together with a channel
for each where the evaluation result
(if any) will be sent.
For each sub-element you can specify 'expression' and/or 'channel' attributes. If only the 'channel' attribute is present the received Message will be sent there as part of a particular synchronization scenario.
If only the 'expression' attribute is present and the result of an expression is a non-Null value, a Message with the result as the payload will be generated and sent to a default channel (NullChannel) and will appear in the logs. If you want the evaluation result to go to a specific channel add a 'channel' attribute. If the result of an expression is null or void, no Message will be generated.
logger
Constructor and Description |
---|
ExpressionEvaluatingTransactionSynchronizationProcessor() |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.expression.spel.support.StandardEvaluationContext |
createEvaluationContext() |
void |
processAfterCommit(IntegrationResourceHolder holder) |
void |
processAfterRollback(IntegrationResourceHolder holder) |
void |
processBeforeCommit(IntegrationResourceHolder holder) |
void |
setAfterCommitChannel(MessageChannel afterCommitChannel) |
void |
setAfterCommitExpression(org.springframework.expression.Expression afterCommitExpression) |
void |
setAfterRollbackChannel(MessageChannel afterRollbackChannel) |
void |
setAfterRollbackExpression(org.springframework.expression.Expression afterRollbackExpression) |
void |
setBeforeCommitChannel(MessageChannel beforeCommitChannel) |
void |
setBeforeCommitExpression(org.springframework.expression.Expression beforeCommitExpression) |
void |
setIntegrationEvaluationContext(org.springframework.expression.EvaluationContext evaluationContext) |
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, onInit, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
public ExpressionEvaluatingTransactionSynchronizationProcessor()
public void setIntegrationEvaluationContext(org.springframework.expression.EvaluationContext evaluationContext)
setIntegrationEvaluationContext
in interface IntegrationEvaluationContextAware
public void setBeforeCommitChannel(MessageChannel beforeCommitChannel)
public void setAfterCommitChannel(MessageChannel afterCommitChannel)
public void setAfterRollbackChannel(MessageChannel afterRollbackChannel)
public void setBeforeCommitExpression(org.springframework.expression.Expression beforeCommitExpression)
public void setAfterCommitExpression(org.springframework.expression.Expression afterCommitExpression)
public void setAfterRollbackExpression(org.springframework.expression.Expression afterRollbackExpression)
public void processBeforeCommit(IntegrationResourceHolder holder)
processBeforeCommit
in interface TransactionSynchronizationProcessor
public void processAfterCommit(IntegrationResourceHolder holder)
processAfterCommit
in interface TransactionSynchronizationProcessor
public void processAfterRollback(IntegrationResourceHolder holder)
processAfterRollback
in interface TransactionSynchronizationProcessor
protected org.springframework.expression.spel.support.StandardEvaluationContext createEvaluationContext()
Copyright © 2016. All rights reserved.