Class JmsMatsTransactionManager_JmsAndJdbc.TransactionalContext_JmsAndJdbc
- All Implemented Interfaces:
JmsMatsStatics
,JmsMatsTransactionManager.TransactionContext
- Enclosing class:
- JmsMatsTransactionManager_JmsAndJdbc
JmsMatsTransactionManager.TransactionContext
-implementation for JmsMatsTransactionManager_Jms
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Raised if commit or rollback of the SQL Connection failed. -
Field Summary
Fields inherited from class io.mats3.impl.jms.JmsMatsTransactionManager_Jms.TransactionalContext_Jms
_txContextKey
Fields inherited from interface io.mats3.impl.jms.JmsMatsStatics
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_MATS_STAGE_INDEX, MDC_TRACE_ID, NO_INVOCATION_POINT, RANDOM_ALPHABET, THREAD_PREFIX, TOTAL_JMS_MSG_PROPS_SIZE
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionalContext_JmsAndJdbc
(DataSource dataSource, JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 JMSSession
).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.mats3.impl.jms.JmsMatsStatics
createFlowId, getInvocationPoint, id, id, idThis, ms3, produceAndSendMsgSysMessages, randomString, setConcurrencyWithLog, stageOrInit
-
Constructor Details
-
TransactionalContext_JmsAndJdbc
public TransactionalContext_JmsAndJdbc(DataSource dataSource, JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey)
-
-
Method Details
-
doTransaction
public void doTransaction(JmsMatsInternalExecutionContext internalExecutionContext, JmsMatsTransactionManager.ProcessingLambda lambda) throws JmsMatsException.JmsMatsJmsException, MatsEndpoint.MatsRefuseMessageException Description copied from interface:JmsMatsTransactionManager.TransactionContext
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 JMSSession
).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.)- Specified by:
doTransaction
in interfaceJmsMatsTransactionManager.TransactionContext
- Overrides:
doTransaction
in classJmsMatsTransactionManager_Jms.TransactionalContext_Jms
- Parameters:
internalExecutionContext
- holds, amongst possibly other stuff, theJmsMatsJmsSessionHandler.JmsSessionHolder
instance which contains the JMS Session upon which this transaction should run. Gotten fromJmsMatsJmsSessionHandler.getSessionHolder(JmsMatsStageProcessor)
orJmsMatsJmsSessionHandler.getSessionHolder(JmsMatsInitiator)
.lambda
- the stuff that shall be done within transaction, i.e. theMatsStage
or theMatsInitiator
.- Throws:
JmsMatsException.JmsMatsJmsException
MatsEndpoint.MatsRefuseMessageException
-