Class AbstractJmsSupport

java.lang.Object
org.mule.jms.commons.internal.support.AbstractJmsSupport
All Implemented Interfaces:
JmsSupport
Direct Known Subclasses:
Jms20Support, Jms30Support

public abstract class AbstractJmsSupport extends Object implements JmsSupport
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractJmsSupport(org.slf4j.Logger logger, LookupJndiDestination lookupJndiDestination, Function<String,Optional<jakarta.jms.Destination>> jndiObjectSupplier, String logPrefix)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.jms.Connection
    createConnection(jakarta.jms.ConnectionFactory connectionFactory)
    Creates a new Connection
    jakarta.jms.Connection
    createConnection(jakarta.jms.ConnectionFactory connectionFactory, String username, String password)
    Creates a new Connection with custom user/password authentication
    jakarta.jms.MessageConsumer
    createConsumer(jakarta.jms.Session session, jakarta.jms.Destination destination, String messageSelector, ConsumerType type)
    Creates a new JMS MessageConsumer using the given Session
    jakarta.jms.Destination
    createDestination(jakarta.jms.Session session, String name, boolean topic, JmsConfig<?,?> config)
    Creates a new JMS Destination with the given name.
    protected Optional<jakarta.jms.Destination>
     
    jakarta.jms.MessageProducer
    createProducer(jakarta.jms.Session session, jakarta.jms.Destination destination, boolean topic)
    Creates a new JMS MessageProducer using the given Session
    jakarta.jms.Session
    createSession(jakarta.jms.Connection connection, boolean topic, boolean transacted, int ackMode)
    Creates a new Session for the given Connection
    jakarta.jms.TemporaryQueue
    createTemporaryDestination(jakarta.jms.Session session)
    Creates an anonymous temporary Queue Destination
    jakarta.jms.XAConnection
    createXaConnection(jakarta.jms.XAConnectionFactory connectionFactory)
    Creates a new XAConnection
    jakarta.jms.XAConnection
    createXaConnection(jakarta.jms.XAConnectionFactory connectionFactory, String username, String password)
    Creates a new XAConnection
    jakarta.jms.XASession
    createXaSession(jakarta.jms.XAConnection connection)
    Creates a new Session for the given Connection
    protected Optional<jakarta.jms.Destination>
     
     
    void
    send(jakarta.jms.MessageProducer producer, jakarta.jms.Message message, boolean persistent, int priority, long ttl, boolean topic)
    Sends the given Message to the indicated Destination using the parametrized configurations
    void
    send(jakarta.jms.MessageProducer producer, jakarta.jms.Message message, boolean persistent, int priority, long ttl, boolean topic, jakarta.jms.CompletionListener completionListener)
    Sends the given Message to the indicated Destination using the parametrized configurations in a async way.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.mule.jms.commons.internal.support.JmsSupport

    getSpecification
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
  • Constructor Details

  • Method Details

    • createConnection

      public jakarta.jms.Connection createConnection(jakarta.jms.ConnectionFactory connectionFactory, String username, String password) throws jakarta.jms.JMSException
      Description copied from interface: JmsSupport
      Creates a new Connection with custom user/password authentication
      Specified by:
      createConnection in interface JmsSupport
      Parameters:
      connectionFactory - the ConnectionFactory to use for creating the Connection
      username - the credentials username
      password - 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: JmsSupport
      Creates a new Connection
      Specified by:
      createConnection in interface JmsSupport
      Parameters:
      connectionFactory - the ConnectionFactory to use for creating the Connection
      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: JmsSupport
      Creates a new XAConnection
      Specified by:
      createXaConnection in interface JmsSupport
      Parameters:
      connectionFactory - the XAConnectionFactory to use for creating the XAConnection
      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: JmsSupport
      Creates a new XAConnection
      Specified by:
      createXaConnection in interface JmsSupport
      Parameters:
      connectionFactory - the XAConnectionFactory to use for creating the XAConnection
      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: JmsSupport
      Creates a new Session for the given Connection
      Specified by:
      createSession in interface JmsSupport
      Parameters:
      connection - the Connection to use for creating the Session
      topic - if true the Session created will be a TopicSession. This distinction is made only for JmsSpecification.JMS_1_0_2b
      transacted - indicates whether the session will use a local transaction
      ackMode - the Session InternalAckMode
      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: JmsSupport
      Creates a new Session for the given Connection
      Specified by:
      createXaSession in interface JmsSupport
      Parameters:
      connection - the XAConnection to use for creating the XASession
      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: JmsSupport
      Creates a new JMS MessageProducer using the given Session
      Specified by:
      createProducer in interface JmsSupport
      Parameters:
      session - the Session used to create the MessageProducer
      destination - the Destination to where the Messages will be published
      topic - if true the given Destination has a Topic destination type. This distinction is made only for JmsSpecification.JMS_1_0_2b in order to decide whether to create a TopicPublisher or a QueueSender
      Returns:
      a new MessageProducer for the given Destination
      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: JmsSupport
      Creates a new JMS MessageConsumer using the given Session
      Specified by:
      createConsumer in interface JmsSupport
      Parameters:
      session - the Session used to create the MessageConsumer
      destination - the Destination from which Messages will be consumed
      messageSelector - a JMS selector string for filtering incoming Messages. Empty or null implies no filtering
      type - the ConsumerType to use based on the Destination type
      Returns:
      a new MessageConsumer for the given Destination
      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, DestinationNotFoundException
      Description copied from interface: JmsSupport
      Creates a new JMS Destination with the given name. If LookupJndiDestination.ALWAYS or LookupJndiDestination.TRY_ALWAYS where configured, this name will be used for performing the JNDI lookup
      Specified by:
      createDestination in interface JmsSupport
      Parameters:
      session - the Session used to create the Destination
      name - the name of the destination
      topic - if true, a Topic Destination will be created, otherwise the Queue default is used
      Returns:
      a new Destination
      Throws:
      jakarta.jms.JMSException - if an error occurs during the creation of the destination
      DestinationNotFoundException - if LookupJndiDestination.ALWAYS is configured and no Destination with the given name is found
    • createDestinationFromJndi

      protected Optional<jakarta.jms.Destination> createDestinationFromJndi(String name)
    • getJndiDestination

      protected Optional<jakarta.jms.Destination> getJndiDestination(String name)
    • createTemporaryDestination

      public jakarta.jms.TemporaryQueue createTemporaryDestination(jakarta.jms.Session session) throws jakarta.jms.JMSException
      Description copied from interface: JmsSupport
      Creates an anonymous temporary Queue Destination
      Specified by:
      createTemporaryDestination in interface JmsSupport
      Parameters:
      session - the Session used to create the Destination
      Returns:
      a new temporary Queue Destination
      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: JmsSupport
      Sends the given Message to the indicated Destination using the parametrized configurations
      Specified by:
      send in interface JmsSupport
      Parameters:
      producer - the MessageProducer to use for sending the message
      message - the Message to send
      persistent - true if DeliveryMode.PERSISTENT should be used
      priority - the Message.getJMSPriority() to be set on send
      ttl - the message's lifetime (in milliseconds)
      topic - used by JmsSpecification.JMS_1_0_2b to decide whether to use the MessageProducer as TopicPublisher or a QueueSender
      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: JmsSupport
      Sends the given Message to the indicated Destination using the parametrized configurations in a async way.
      Specified by:
      send in interface JmsSupport
      Parameters:
      producer - the MessageProducer to use for sending the message
      message - the Message to send
      persistent - true if DeliveryMode.PERSISTENT should be used
      priority - the Message.getJMSPriority() to be set on send
      ttl - the message's lifetime (in milliseconds)
      topic - used by JmsSpecification.JMS_1_0_2b to decide whether to use the MessageProducer as TopicPublisher or a QueueSender
      Throws:
      jakarta.jms.JMSException - if an error occurs during messsage sending
    • getLookupJndiDestination

      protected LookupJndiDestination getLookupJndiDestination()