Class ConnectionProxy

java.lang.Object
org.jboss.narayana.jta.jms.ConnectionProxy
All Implemented Interfaces:
jakarta.jms.Connection, AutoCloseable

public class ConnectionProxy extends Object implements jakarta.jms.Connection
Proxy connection to wrap around provided XAConnection.
Author:
Gytis Trikleris
  • Constructor Details

    • ConnectionProxy

      public ConnectionProxy(jakarta.jms.XAConnection xaConnection, TransactionHelper transactionHelper)
      Parameters:
      xaConnection - XA connection which needs to be proxied.
      transactionHelper - utility to make transaction resources registration easier.
  • Method Details

    • createSession

      public jakarta.jms.Session createSession(boolean transacted, int acknowledgeMode) throws jakarta.jms.JMSException
      Simply create a session with an XA connection if there is no active transaction. Or create a proxied session and register it with an active transaction.
      Specified by:
      createSession in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
    • createSession

      public jakarta.jms.Session createSession(int sessionMode) throws jakarta.jms.JMSException
      Specified by:
      createSession in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • createSession

      public jakarta.jms.Session createSession() throws jakarta.jms.JMSException
      Specified by:
      createSession in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • close

      public void close() throws jakarta.jms.JMSException
      Simply close the proxied connection if there is no active transaction. Or register a ConnectionClosingSynchronization if active transaction exists.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException - if transaction service has failed (in unexpected way) to obtain transaction status, or if synchronization registration, or connection closing has failed.
    • getClientID

      public String getClientID() throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      getClientID in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.getClientID()
    • setClientID

      public void setClientID(String clientID) throws jakarta.jms.JMSException
      Specified by:
      setClientID in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.setClientID(String)
    • getMetaData

      public jakarta.jms.ConnectionMetaData getMetaData() throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      getMetaData in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.getMetaData()
    • getExceptionListener

      public jakarta.jms.ExceptionListener getExceptionListener() throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      getExceptionListener in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.getExceptionListener()
    • setExceptionListener

      public void setExceptionListener(jakarta.jms.ExceptionListener listener) throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      setExceptionListener in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.setExceptionListener(ExceptionListener)
    • start

      public void start() throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      start in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.start()
    • stop

      public void stop() throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      stop in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.stop()
    • createConnectionConsumer

      public jakarta.jms.ConnectionConsumer createConnectionConsumer(jakarta.jms.Destination destination, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException
      Delegate to xaConnection
      Specified by:
      createConnectionConsumer in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.createConnectionConsumer(Destination, String, ServerSessionPool, int)
    • createSharedConnectionConsumer

      public jakarta.jms.ConnectionConsumer createSharedConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException
      Specified by:
      createSharedConnectionConsumer in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
    • createDurableConnectionConsumer

      public jakarta.jms.ConnectionConsumer createDurableConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException
      Delegate to xaConnection.
      Specified by:
      createDurableConnectionConsumer in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException
      See Also:
      • Connection.createDurableConnectionConsumer(Topic, String, String, ServerSessionPool, int)
    • createSharedDurableConnectionConsumer

      public jakarta.jms.ConnectionConsumer createSharedDurableConnectionConsumer(jakarta.jms.Topic topic, String subscriptionName, String messageSelector, jakarta.jms.ServerSessionPool sessionPool, int maxMessages) throws jakarta.jms.JMSException
      Specified by:
      createSharedDurableConnectionConsumer in interface jakarta.jms.Connection
      Throws:
      jakarta.jms.JMSException