Class AbstractJmsSupport
java.lang.Object
org.mule.jms.commons.internal.support.AbstractJmsSupport
- All Implemented Interfaces:
JmsSupport
- Direct Known Subclasses:
Jms20Support,Jms30Support
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractJmsSupport(org.slf4j.Logger logger, LookupJndiDestination lookupJndiDestination, Function<String, Optional<jakarta.jms.Destination>> jndiObjectSupplier, String logPrefix) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.jms.ConnectioncreateConnection(jakarta.jms.ConnectionFactory connectionFactory) Creates a newConnectionjakarta.jms.ConnectioncreateConnection(jakarta.jms.ConnectionFactory connectionFactory, String username, String password) Creates a newConnectionwith custom user/password authenticationjakarta.jms.MessageConsumercreateConsumer(jakarta.jms.Session session, jakarta.jms.Destination destination, String messageSelector, ConsumerType type) Creates a new JMSMessageConsumerusing the givenSessionjakarta.jms.DestinationcreateDestination(jakarta.jms.Session session, String name, boolean topic, JmsConfig<?, ?> config) Creates a new JMSDestinationwith the givenname.protected Optional<jakarta.jms.Destination>jakarta.jms.MessageProducercreateProducer(jakarta.jms.Session session, jakarta.jms.Destination destination, boolean topic) Creates a new JMSMessageProducerusing the givenSessionjakarta.jms.SessioncreateSession(jakarta.jms.Connection connection, boolean topic, boolean transacted, int ackMode) Creates a newSessionfor the givenConnectionjakarta.jms.TemporaryQueuecreateTemporaryDestination(jakarta.jms.Session session) Creates an anonymous temporaryQueueDestinationjakarta.jms.XAConnectioncreateXaConnection(jakarta.jms.XAConnectionFactory connectionFactory) Creates a newXAConnectionjakarta.jms.XAConnectioncreateXaConnection(jakarta.jms.XAConnectionFactory connectionFactory, String username, String password) Creates a newXAConnectionjakarta.jms.XASessioncreateXaSession(jakarta.jms.XAConnection connection) Creates a newSessionfor the givenConnectionprotected Optional<jakarta.jms.Destination>getJndiDestination(String name) protected LookupJndiDestinationvoidsend(jakarta.jms.MessageProducer producer, jakarta.jms.Message message, boolean persistent, int priority, long ttl, boolean topic) Sends the givenMessageto the indicatedDestinationusing the parametrized configurationsvoidsend(jakarta.jms.MessageProducer producer, jakarta.jms.Message message, boolean persistent, int priority, long ttl, boolean topic, jakarta.jms.CompletionListener completionListener) Sends the givenMessageto the indicatedDestinationusing the parametrized configurations in a async way.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mule.jms.commons.internal.support.JmsSupport
getSpecification
-
Field Details
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
AbstractJmsSupport
protected AbstractJmsSupport(org.slf4j.Logger logger, LookupJndiDestination lookupJndiDestination, Function<String, Optional<jakarta.jms.Destination>> jndiObjectSupplier, String logPrefix)
-
-
Method Details
-
createConnection
public jakarta.jms.Connection createConnection(jakarta.jms.ConnectionFactory connectionFactory, String username, String password) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a newConnectionwith custom user/password authentication- Specified by:
createConnectionin interfaceJmsSupport- Parameters:
connectionFactory- theConnectionFactoryto use for creating theConnectionusername- the credentials usernamepassword- the credentials password- Returns:
- a new
Connection - Throws:
jakarta.jms.JMSException- if an error occurs during connection creation
-
createConnection
public jakarta.jms.Connection createConnection(jakarta.jms.ConnectionFactory connectionFactory) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a newConnection- Specified by:
createConnectionin interfaceJmsSupport- Parameters:
connectionFactory- theConnectionFactoryto use for creating theConnection- Returns:
- a new
Connection - Throws:
jakarta.jms.JMSException- if an error occurs during connection creation
-
createXaConnection
public jakarta.jms.XAConnection createXaConnection(jakarta.jms.XAConnectionFactory connectionFactory) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a newXAConnection- Specified by:
createXaConnectionin interfaceJmsSupport- Parameters:
connectionFactory- theXAConnectionFactoryto use for creating theXAConnection- Returns:
- a new
Connection - Throws:
jakarta.jms.JMSException- if an error occurs during connection creation
-
createXaConnection
public jakarta.jms.XAConnection createXaConnection(jakarta.jms.XAConnectionFactory connectionFactory, String username, String password) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a newXAConnection- Specified by:
createXaConnectionin interfaceJmsSupport- Parameters:
connectionFactory- theXAConnectionFactoryto use for creating theXAConnection- Returns:
- a new
Connection - Throws:
jakarta.jms.JMSException- if an error occurs during connection creation
-
createSession
public jakarta.jms.Session createSession(jakarta.jms.Connection connection, boolean topic, boolean transacted, int ackMode) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a newSessionfor the givenConnection- Specified by:
createSessionin interfaceJmsSupport- Parameters:
connection- theConnectionto use for creating theSessiontopic- iftruetheSessioncreated will be aTopicSession. This distinction is made only forJmsSpecification.JMS_1_0_2btransacted- indicates whether the session will use a local transactionackMode- theSessionInternalAckMode- Returns:
- a new
Session - Throws:
jakarta.jms.JMSException- if an error occurs during connection creation
-
createXaSession
public jakarta.jms.XASession createXaSession(jakarta.jms.XAConnection connection) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a newSessionfor the givenConnection- Specified by:
createXaSessionin interfaceJmsSupport- Parameters:
connection- theXAConnectionto use for creating theXASession- Returns:
- a new
XASession - Throws:
jakarta.jms.JMSException- if an error occurs during connection creation
-
createProducer
public jakarta.jms.MessageProducer createProducer(jakarta.jms.Session session, jakarta.jms.Destination destination, boolean topic) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a new JMSMessageProducerusing the givenSession- Specified by:
createProducerin interfaceJmsSupport- Parameters:
session- theSessionused to create theMessageProducerdestination- theDestinationto where theMessages will be publishedtopic- 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
-
createConsumer
public jakarta.jms.MessageConsumer createConsumer(jakarta.jms.Session session, jakarta.jms.Destination destination, String messageSelector, ConsumerType type) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates a new JMSMessageConsumerusing the givenSession- Specified by:
createConsumerin interfaceJmsSupport- Parameters:
session- theSessionused to create theMessageConsumerdestination- theDestinationfrom whichMessages will be consumedmessageSelector- a JMS selector string for filtering incomingMessages. Empty ornullimplies no filteringtype- theConsumerTypeto use based on theDestinationtype- Returns:
- a new
MessageConsumerfor the givenDestination - Throws:
jakarta.jms.JMSException- if an error occurs while creating the consumer
-
createDestination
public jakarta.jms.Destination createDestination(jakarta.jms.Session session, String name, boolean topic, JmsConfig<?, ?> config) throws jakarta.jms.JMSException, DestinationNotFoundExceptionDescription copied from interface:JmsSupportCreates a new JMSDestinationwith the givenname. IfLookupJndiDestination.ALWAYSorLookupJndiDestination.TRY_ALWAYSwhere configured, thisnamewill be used for performing the JNDI lookup- Specified by:
createDestinationin interfaceJmsSupport- Parameters:
session- theSessionused to create theDestinationname- the name of the destinationtopic- iftrue, aTopicDestinationwill be created, otherwise theQueuedefault is used- Returns:
- a new
Destination - Throws:
jakarta.jms.JMSException- if an error occurs during the creation of the destinationDestinationNotFoundException- ifLookupJndiDestination.ALWAYSis configured and noDestinationwith the givennameis found
-
createDestinationFromJndi
-
getJndiDestination
-
createTemporaryDestination
public jakarta.jms.TemporaryQueue createTemporaryDestination(jakarta.jms.Session session) throws jakarta.jms.JMSException Description copied from interface:JmsSupportCreates an anonymous temporaryQueueDestination- Specified by:
createTemporaryDestinationin interfaceJmsSupport- Parameters:
session- theSessionused to create theDestination- Returns:
- a new temporary
QueueDestination - Throws:
jakarta.jms.JMSException- if an error occurs during destination creation
-
send
public void send(jakarta.jms.MessageProducer producer, jakarta.jms.Message message, boolean persistent, int priority, long ttl, boolean topic) throws jakarta.jms.JMSException Description copied from interface:JmsSupportSends the givenMessageto the indicatedDestinationusing the parametrized configurations- Specified by:
sendin interfaceJmsSupport- Parameters:
producer- theMessageProducerto use for sending the messagemessage- theMessageto sendpersistent-trueifDeliveryMode.PERSISTENTshould be usedpriority- theMessage.getJMSPriority()to be set on sendttl- the message's lifetime (in milliseconds)topic- used byJmsSpecification.JMS_1_0_2bto decide whether to use theMessageProducerasTopicPublisheror aQueueSender- Throws:
jakarta.jms.JMSException- if an error occurs during messsage sending
-
send
public void send(jakarta.jms.MessageProducer producer, jakarta.jms.Message message, boolean persistent, int priority, long ttl, boolean topic, jakarta.jms.CompletionListener completionListener) throws jakarta.jms.JMSException Description copied from interface:JmsSupportSends the givenMessageto the indicatedDestinationusing the parametrized configurations in a async way.- Specified by:
sendin interfaceJmsSupport- Parameters:
producer- theMessageProducerto use for sending the messagemessage- theMessageto sendpersistent-trueifDeliveryMode.PERSISTENTshould be usedpriority- theMessage.getJMSPriority()to be set on sendttl- the message's lifetime (in milliseconds)topic- used byJmsSpecification.JMS_1_0_2bto decide whether to use theMessageProducerasTopicPublisheror aQueueSender- Throws:
jakarta.jms.JMSException- if an error occurs during messsage sending
-
getLookupJndiDestination
-