public static class JmsMatsTransactionManager_JmsAndJdbc.TransactionalContext_JmsAndJdbc extends JmsMatsTransactionManager_Jms.TransactionalContext_Jms
TransactionContext
-implementation for JmsMatsTransactionManager_Jms
.Modifier and Type | Class and Description |
---|---|
static class |
JmsMatsTransactionManager_JmsAndJdbc.TransactionalContext_JmsAndJdbc.MatsSqlCommitOrRollbackFailedException
Raised if commit or rollback of the SQL Connection failed.
|
_txContextKey
EXTRA_GRACE_MILLIS, ILLEGAL_CALL_FLOWS, JMS_MSG_PROP_AUDIT, JMS_MSG_PROP_DISPATCH_TYPE, JMS_MSG_PROP_FROM, JMS_MSG_PROP_INITIALIZING_APP, JMS_MSG_PROP_INITIATOR_ID, JMS_MSG_PROP_MATS_MESSAGE_ID, JMS_MSG_PROP_MESSAGE_TYPE, JMS_MSG_PROP_TO, JMS_MSG_PROP_TRACE_ID, LOG_PREFIX, MAX_STACK_HEIGHT, MAX_TOTAL_CALL_NUMBER, MDC_MATS_APP_NAME, MDC_MATS_APP_VERSION, MDC_MATS_CALL_NUMBER, MDC_MATS_IN_MESSAGE_SYSTEM_ID, MDC_MATS_INIT, MDC_MATS_OUT_MATS_MESSAGE_ID, MDC_MATS_STAGE, MDC_MATS_STAGE_ID, MDC_TRACE_ID, NO_INVOCATION_POINT, RANDOM_ALPHABET, THREAD_PREFIX, TOTAL_JMS_MSG_PROPS_SIZE
Constructor and Description |
---|
TransactionalContext_JmsAndJdbc(javax.sql.DataSource dataSource,
JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey) |
Modifier and Type | Method and Description |
---|---|
void |
doTransaction(JmsMatsInternalExecutionContext internalExecutionContext,
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 ). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createFlowId, getInvocationPoint, handleIncomingMessageMatsObject, handleIncomingState, id, id, idThis, ms3, produceAndSendMsgSysMessages, randomString, setConcurrencyWithLog, stageOrInit
public TransactionalContext_JmsAndJdbc(javax.sql.DataSource dataSource, JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey)
public void doTransaction(JmsMatsInternalExecutionContext internalExecutionContext, JmsMatsTransactionManager.ProcessingLambda lambda) throws JmsMatsException.JmsMatsJmsException, MatsEndpoint.MatsRefuseMessageException
JmsMatsTransactionManager.TransactionContext
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.)
doTransaction
in interface JmsMatsTransactionManager.TransactionContext
doTransaction
in class JmsMatsTransactionManager_Jms.TransactionalContext_Jms
internalExecutionContext
- 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