Class JmsConnection
java.lang.Object
org.mule.jms.commons.internal.connection.JmsConnection
- All Implemented Interfaces:
org.mule.runtime.api.lifecycle.Disposable,org.mule.runtime.api.lifecycle.Stoppable
- Direct Known Subclasses:
JmsTransactionalConnection
public class JmsConnection
extends Object
implements org.mule.runtime.api.lifecycle.Stoppable, org.mule.runtime.api.lifecycle.Disposable
A Connection for the JmsConnector
- Since:
- 1.0
-
Field Summary
Fields inherited from interface org.mule.runtime.api.lifecycle.Disposable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Stoppable
PHASE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionJmsConnection(JmsSupport jmsSupport, jakarta.jms.Connection connection, JmsSessionManager jmsSessionManager, CompositeJmsExceptionListener exceptionListener) -
Method Summary
Modifier and TypeMethodDescriptioncreateConsumer(JmsSession session, jakarta.jms.Destination jmsDestination, String selector, ConsumerType consumerType) Creates a new JMSMessageConsumerusing the givenSessioncreateConsumer(JmsSession session, jakarta.jms.Destination jmsDestination, String selector, ConsumerType consumerType, boolean avoidCaching) Creates a new JMSMessageConsumerusing the givenSessioncreateProducer(JmsSession session, jakarta.jms.Destination jmsDestination, boolean isTopic) Creates a new JMSMessageProducerusing the givenSessioncreateSession(InternalAckMode ackMode, boolean isTopic) Creates a new JMSSessionusing the currentConnectionvoiddispose()jakarta.jms.Connectionget()voidregisterExceptionListener(jakarta.jms.ExceptionListener exceptionListener) voidremoveExceptionListener(jakarta.jms.ExceptionListener exceptionListener) voidsetConnection(jakarta.jms.Connection connection) voidstop()Temporarily stops a connection's delivery of incoming messages.
-
Constructor Details
-
JmsConnection
public JmsConnection(JmsSupport jmsSupport, jakarta.jms.Connection connection, JmsSessionManager jmsSessionManager, CompositeJmsExceptionListener exceptionListener)
-
-
Method Details
-
getJmsSupport
-
get
public jakarta.jms.Connection get() -
setConnection
public void setConnection(jakarta.jms.Connection connection) -
createSession
public JmsSession createSession(InternalAckMode ackMode, boolean isTopic) throws jakarta.jms.JMSException Creates a new JMSSessionusing the currentConnection- Parameters:
ackMode- theSessionInternalAckModeisTopic- iftruetheSessioncreated will be aTopicSession. This distinction is made only forJmsSpecification.JMS_1_0_2b]- Returns:
- a new
Session - Throws:
jakarta.jms.JMSException- if an error occurs while creating theSession
-
createConsumer
public JmsMessageConsumer createConsumer(JmsSession session, jakarta.jms.Destination jmsDestination, String selector, ConsumerType consumerType, boolean avoidCaching) throws jakarta.jms.JMSException Creates a new JMSMessageConsumerusing the givenSession- Parameters:
session- theJmsSessionused to create theMessageConsumerjmsDestination- theDestinationfrom whichMessages will be consumedselector- a JMS selector string for filtering incomingMessages. Empty ornullimplies no filteringconsumerType- theConsumerTypeto use based on theDestinationtypeavoidCaching- indicates if the consumer should prevent be cached.- Returns:
- a new
MessageConsumerfor the givenDestination - Throws:
jakarta.jms.JMSException- if an error occurs while creating the consumer
-
createConsumer
public JmsMessageConsumer createConsumer(JmsSession session, jakarta.jms.Destination jmsDestination, String selector, ConsumerType consumerType) throws jakarta.jms.JMSException Creates a new JMSMessageConsumerusing the givenSession- Parameters:
session- theJmsSessionused to create theMessageConsumerjmsDestination- theDestinationfrom whichMessages will be consumedselector- a JMS selector string for filtering incomingMessages. Empty ornullimplies no filteringconsumerType- theConsumerTypeto use based on theDestinationtype- Returns:
- a new
MessageConsumerfor the givenDestination - Throws:
jakarta.jms.JMSException- if an error occurs while creating the consumer
-
createProducer
public JmsMessageProducer createProducer(JmsSession session, jakarta.jms.Destination jmsDestination, boolean isTopic) throws jakarta.jms.JMSException Creates a new JMSMessageProducerusing the givenSession- Parameters:
session- theJmsSessionused to create theMessageProducerjmsDestination- theDestinationto where theMessages will be publishedisTopic- iftruethe givenDestinationhas aTopicdestination type. This distinction is made only forJmsSpecification.JMS_1_0_2bin order to decide whether to create aTopicPublisheror aQueueSender- Returns:
- a new
MessageProducerfor the givenDestination - Throws:
jakarta.jms.JMSException- if an error occurs while creating the consumer
-
stop
public void stop() throws org.mule.runtime.api.exception.MuleExceptionTemporarily stops a connection's delivery of incoming messages. Delivery can be restarted using the connection'sstartmethod. When the connection is stopped, delivery to all the connection's message consumers is inhibited.- Specified by:
stopin interfaceorg.mule.runtime.api.lifecycle.Stoppable- Throws:
org.mule.runtime.api.exception.MuleException
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.mule.runtime.api.lifecycle.Disposable
-
registerExceptionListener
public void registerExceptionListener(jakarta.jms.ExceptionListener exceptionListener) -
removeExceptionListener
public void removeExceptionListener(jakarta.jms.ExceptionListener exceptionListener) -
getJmsSessionManager
-