Class JmsSessionManager
java.lang.Object
org.mule.jms.commons.internal.connection.session.JmsSessionManager
Manager that takes the responsibility of register the session information to be able to execute a manual acknowledgement or a
recover over a
Session. This is used when the InternalAckMode is configured in InternalAckMode.MANUAL- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidack(String ackId, AckCallback ackCallback) Executes theMessage.acknowledge()on the latestMessageassociated to theSessionidentified by theackIdvoidbindToTransaction(JmsSession session) Binds the givenJmsSessionto the currentThreadvoidbindToTransaction(org.mule.runtime.extension.api.connectivity.XATransactionalConnection jmsXaTransactionalConnection, JmsSession session, JmsXaContext xaResource) voidchangeTransactionStatus(TransactionStatus transactionStatus) getJmsXaContext(JmsTransactionalConnection xaTransactionalConnection) Returns the set of pending acknowledgementsgetTransactedSession(JmsConnection connection) getXaTransactedSession(org.mule.runtime.extension.api.connectivity.XATransactionalConnection jmsXaTransactionalConnection) booleanisPendingAck(String ackId) voidrecoverSession(String ackId, AckCallback ackCallback) Executes theSession.recover()over theSessionidentified by theackIdvoidregisterMessageForAck(String ackId, jakarta.jms.Message message, jakarta.jms.Session session, JmsListenerLock jmsLock) Registers theMessageto theSessionusing theackIdin order to being able later to perform aInternalAckMode.MANUALACKvoidregisterMessageForAck(String ackId, jakarta.jms.Message message, jakarta.jms.Session session, JmsListenerLock jmsLock, JmsMessageAckedMonitor jmsMessageAckedMonitor) voidUnbinds the currentJmsSession, if there is one, of the currentThreadvoidunbindSession(org.mule.runtime.extension.api.connectivity.XATransactionalConnection jmsXaTransactionalConnection) Unbinds the currentJmsSession, if there is one, of the currentThread
-
Constructor Details
-
JmsSessionManager
public JmsSessionManager()
-
-
Method Details
-
registerMessageForAck
public void registerMessageForAck(String ackId, jakarta.jms.Message message, jakarta.jms.Session session, JmsListenerLock jmsLock) Registers theMessageto theSessionusing theackIdin order to being able later to perform aInternalAckMode.MANUALACK- Parameters:
ackId- the id associated to theSessionused to create theMessagemessage- theMessageto use for executing theMessage.acknowledge()jmsLock- the optionalJmsListenerLockto be able to unlock theJmsListener- Throws:
IllegalArgumentException- if no Session was registered with the given AckId
-
registerMessageForAck
public void registerMessageForAck(String ackId, jakarta.jms.Message message, jakarta.jms.Session session, JmsListenerLock jmsLock, JmsMessageAckedMonitor jmsMessageAckedMonitor) -
isPendingAck
-
ack
Executes theMessage.acknowledge()on the latestMessageassociated to theSessionidentified by theackId- Parameters:
ackId- the id associated to theSessionthat should be ACKed
-
recoverSession
Executes theSession.recover()over theSessionidentified by theackId- Parameters:
ackId- the id associated to theSessionused to create theMessage
-
bindToTransaction
Binds the givenJmsSessionto the currentThread- Parameters:
session- session to bind
-
bindToTransaction
public void bindToTransaction(org.mule.runtime.extension.api.connectivity.XATransactionalConnection jmsXaTransactionalConnection, JmsSession session, JmsXaContext xaResource) - Parameters:
session- session to bind
-
unbindSession
public void unbindSession()Unbinds the currentJmsSession, if there is one, of the currentThread -
unbindSession
public void unbindSession(org.mule.runtime.extension.api.connectivity.XATransactionalConnection jmsXaTransactionalConnection) Unbinds the currentJmsSession, if there is one, of the currentThread -
getTransactedSession
- Returns:
- the
OptionalJmsSessionof the currentThread
-
getXaTransactedSession
public Optional<JmsSession> getXaTransactedSession(org.mule.runtime.extension.api.connectivity.XATransactionalConnection jmsXaTransactionalConnection) -
getTransactionStatus
- Returns:
- The status of the transaction. -
TransactionStatus.NONEmeans that there is no started transaction for the currentThread-TransactionStatus.STARTEDmeans that there is a transaction being executed in the currentThread
-
changeTransactionStatus
- Parameters:
transactionStatus- The newTransactionStatus
-
getJmsXaContext
- Returns:
- the
OptionalJmsXaContextof the currentThread
-
getPendingAcknowledgements
Returns the set of pending acknowledgements- Returns:
- the set of pending acknowledgements
-