Class ExpressionEvaluatingTransactionSynchronizationProcessor
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transaction.ExpressionEvaluatingTransactionSynchronizationProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,ExpressionCapable
,NamedComponent
,TransactionSynchronizationProcessor
public class ExpressionEvaluatingTransactionSynchronizationProcessor extends IntegrationObjectSupport implements TransactionSynchronizationProcessor
This implementation of
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.
- Since:
- 2.2
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description ExpressionEvaluatingTransactionSynchronizationProcessor()
-
Method Summary
Modifier and Type Method Description protected org.springframework.expression.spel.support.StandardEvaluationContext
createEvaluationContext()
protected void
onInit()
Subclasses may implement this for initialization logic.void
processAfterCommit(IntegrationResourceHolder holder)
void
processAfterRollback(IntegrationResourceHolder holder)
void
processBeforeCommit(IntegrationResourceHolder holder)
void
setAfterCommitChannel(org.springframework.messaging.MessageChannel afterCommitChannel)
void
setAfterCommitExpression(org.springframework.expression.Expression afterCommitExpression)
void
setAfterRollbackChannel(org.springframework.messaging.MessageChannel afterRollbackChannel)
void
setAfterRollbackExpression(org.springframework.expression.Expression afterRollbackExpression)
void
setBeforeCommitChannel(org.springframework.messaging.MessageChannel beforeCommitChannel)
void
setBeforeCommitExpression(org.springframework.expression.Expression beforeCommitExpression)
void
setIntegrationEvaluationContext(org.springframework.expression.EvaluationContext evaluationContext)
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Constructor Details
-
ExpressionEvaluatingTransactionSynchronizationProcessor
public ExpressionEvaluatingTransactionSynchronizationProcessor()
-
-
Method Details
-
setIntegrationEvaluationContext
public void setIntegrationEvaluationContext(org.springframework.expression.EvaluationContext evaluationContext) -
setBeforeCommitChannel
public void setBeforeCommitChannel(org.springframework.messaging.MessageChannel beforeCommitChannel) -
setAfterCommitChannel
public void setAfterCommitChannel(org.springframework.messaging.MessageChannel afterCommitChannel) -
setAfterRollbackChannel
public void setAfterRollbackChannel(org.springframework.messaging.MessageChannel afterRollbackChannel) -
setBeforeCommitExpression
public void setBeforeCommitExpression(org.springframework.expression.Expression beforeCommitExpression) -
setAfterCommitExpression
public void setAfterCommitExpression(org.springframework.expression.Expression afterCommitExpression) -
setAfterRollbackExpression
public void setAfterRollbackExpression(org.springframework.expression.Expression afterRollbackExpression) -
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classIntegrationObjectSupport
-
processBeforeCommit
- Specified by:
processBeforeCommit
in interfaceTransactionSynchronizationProcessor
-
processAfterCommit
- Specified by:
processAfterCommit
in interfaceTransactionSynchronizationProcessor
-
processAfterRollback
- Specified by:
processAfterRollback
in interfaceTransactionSynchronizationProcessor
-
createEvaluationContext
protected org.springframework.expression.spel.support.StandardEvaluationContext createEvaluationContext()
-