@FunctionalInterface
public static interface JmsMatsTransactionManager.TransactionContext
JmsMatsTransactionManager.ProcessingLambda
by rolling back.Modifier and Type | Method and Description |
---|---|
void |
doTransaction(JmsMatsInternalExecutionContext jmsSessionMessageContext,
JmsMatsTransactionManager.ProcessingLambda lambda)
Shall open relevant transactions (that are not already opened by means of JMS's "always in transaction" for
transactional Connections), perform the provided lambda, and then commit the transactions (including the JMS
Session ). |
void doTransaction(JmsMatsInternalExecutionContext jmsSessionMessageContext, JmsMatsTransactionManager.ProcessingLambda lambda) throws JmsMatsException.JmsMatsJmsException, MatsEndpoint.MatsRefuseMessageException
Session
).
If any Exception occurs when executing the provided lambda, then the transactions should be rolled
back - but if it is the declared special MatsEndpoint.MatsRefuseMessageException
, then the implementation should
also try to ensure that the underlying JMS Message is not redelivered (no more retries), but instead put on
the DLQ right away. (Beware of "sneaky throws": The JVM bytecode doesn't care whether a method declares an
exception or not: It is possible to throw a checked exception form a method that doesn't declare it in
several different ways. Groovy is nasty here (as effectively all Exceptions are unchecked in the Groovy
world), and also google "sneakyThrows" for a way to do it using "pure java" that was invented with
Generics.)
jmsSessionMessageContext
- holds, amongst possibly other stuff, the JmsMatsJmsSessionHandler.JmsSessionHolder
instance which contains the JMS
Session upon which this transaction should run. Gotten from
JmsMatsJmsSessionHandler.getSessionHolder(JmsMatsStageProcessor)
or
JmsMatsJmsSessionHandler.getSessionHolder(JmsMatsInitiator)
.lambda
- the stuff that shall be done within transaction, i.e. the MatsStage
or the
MatsInitiator
.JmsMatsException.JmsMatsJmsException
MatsEndpoint.MatsRefuseMessageException