Class JmsCommons
java.lang.Object
org.mule.jms.commons.internal.common.JmsCommons
Utility class to reuse logic for JMS Extension
- Since:
- 1.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(AutoCloseable closable) ClosesthisConnectionresource without throwing an exception (an error message is logged instead)static JmsSessioncreateJmsSession(JmsConnection jmsConnection, InternalAckMode ackMode, boolean isTopic, JmsSessionManager jmsSessionManager, org.mule.runtime.extension.api.tx.OperationTransactionalAction transactionalAction) Utility method to create newJmsSessionfrom a givenJmsConnectionstatic voidevaluateMessageAck(InternalAckMode ackMode, JmsSession session, jakarta.jms.Message receivedMessage, JmsSessionManager messageSessionManager, JmsListenerLock jmsLock, JmsMessageAckedMonitor jmsMessageAckedMonitor) static StringgetDestinationType(jakarta.jms.Destination consumerType) static StringgetDestinationType(ConsumerType consumerType) static StringgetDestinationType(DestinationTypeDescriptor consumerType) static booleanisManualAck(JmsSession session) Verifies if the given session ACK Mode isAckMode.MANUALstatic booleanisPartOfCurrentTx(JmsSession session, JmsConnection jmsConnection, JmsSessionManager sessionManager) Verifies if the given session is part of the current TX.static voidreleaseResources(JmsSession session, boolean isPartOfCurrentTx, AutoCloseable... closeables) Releases all the resources that are required to close.static StringresolveMessageContentType(jakarta.jms.Message message, String defaultType) static StringresolveMessageEncoding(jakarta.jms.Message message, String defaultType) static <T> TresolveOverride(T configValue, T operationValue) static voidstopQuietly(Object stoppable) StopsthisStoppableresource without throwing an exception (an error message is logged instead)static InternalAckModetoInternalAckMode(JmsAckMode jmsAckMode)
-
Field Details
-
TOPIC
- See Also:
-
QUEUE
- See Also:
-
EXAMPLE_ENCODING
- See Also:
-
EXAMPLE_CONTENT_TYPE
- See Also:
-
-
Constructor Details
-
JmsCommons
public JmsCommons()
-
-
Method Details
-
resolveMessageContentType
-
resolveMessageEncoding
-
resolveOverride
public static <T> T resolveOverride(T configValue, T operationValue) -
evaluateMessageAck
public static void evaluateMessageAck(InternalAckMode ackMode, JmsSession session, jakarta.jms.Message receivedMessage, JmsSessionManager messageSessionManager, JmsListenerLock jmsLock, JmsMessageAckedMonitor jmsMessageAckedMonitor) throws JmsAckException - Throws:
JmsAckException
-
createJmsSession
public static JmsSession createJmsSession(JmsConnection jmsConnection, InternalAckMode ackMode, boolean isTopic, JmsSessionManager jmsSessionManager, org.mule.runtime.extension.api.tx.OperationTransactionalAction transactionalAction) throws jakarta.jms.JMSException Utility method to create newJmsSessionfrom a givenJmsConnection- Parameters:
jmsConnection- the connection from where create a newJmsSessionackMode- theInternalAckModeto useisTopic- Indicates if the destination is whether a topic or a queuejmsSessionManager-JmsSessionManagerto retrieve information about the current transaction status- Returns:
- a new
JmsSessionfrom the givenJmsConnection - Throws:
jakarta.jms.JMSException- If an error happens creating a newJmsSession
-
toInternalAckMode
-
releaseResources
public static void releaseResources(JmsSession session, boolean isPartOfCurrentTx, AutoCloseable... closeables) Releases all the resources that are required to close. The session only will be closed if this one doesn't belong to the current transaction or it doesn't have an a Client ACK.- Parameters:
session- Session to closecloseables- All the things that can be closed
-
isManualAck
Verifies if the given session ACK Mode isAckMode.MANUAL -
isPartOfCurrentTx
public static boolean isPartOfCurrentTx(JmsSession session, JmsConnection jmsConnection, JmsSessionManager sessionManager) Verifies if the given session is part of the current TX. -
closeQuietly
ClosesthisConnectionresource without throwing an exception (an error message is logged instead)- Parameters:
closable- the resource to close
-
stopQuietly
StopsthisStoppableresource without throwing an exception (an error message is logged instead)- Parameters:
stoppable- the resource to stop
-
getDestinationType
-
getDestinationType
-
getDestinationType
-