Class AmqpSession

java.lang.Object
org.apache.qpid.jms.provider.amqp.AmqpAbstractResource<JmsSessionInfo,org.apache.qpid.proton.engine.Session>
org.apache.qpid.jms.provider.amqp.AmqpSession
All Implemented Interfaces:
AmqpEventSink, AmqpResource, AmqpResourceParent
Direct Known Subclasses:
AmqpConnectionSession

public class AmqpSession extends AmqpAbstractResource<JmsSessionInfo,org.apache.qpid.proton.engine.Session> implements AmqpResourceParent
  • Constructor Details

  • Method Details

    • acknowledge

      public void acknowledge(ProviderConstants.ACK_TYPE ackType)
      Perform an acknowledge of all delivered messages for all consumers active in this Session.
      Parameters:
      ackType - controls the acknowledgement that is applied to each message.
    • recover

      public void recover() throws Exception
      Perform re-send of all delivered but not yet acknowledged messages for all consumers active in this Session.
      Throws:
      Exception - if an error occurs while performing the recover.
    • createProducer

      public void createProducer(JmsProducerInfo producerInfo, AsyncResult request)
    • getProducer

      public AmqpProducer getProducer(JmsProducerInfo producerInfo)
    • createConsumer

      public void createConsumer(JmsConsumerInfo consumerInfo, AsyncResult request)
    • getConsumer

      public AmqpConsumer getConsumer(JmsConsumerInfo consumerInfo)
    • getTransactionContext

      public AmqpTransactionContext getTransactionContext()
    • begin

      public void begin(JmsTransactionId txId, AsyncResult request) throws Exception
      Begins a new Transaction using the given Transaction Id as the identifier. The AMQP binary Transaction Id will be stored in the provider hint value of the given transaction.
      Parameters:
      txId - The JMS Framework's assigned Transaction Id for the new TX.
      request - The request that will be signaled on completion of this operation.
      Throws:
      Exception - if an error occurs while performing the operation.
    • commit

      public void commit(JmsTransactionInfo transactionInfo, JmsTransactionInfo nextTransactionInfo, AsyncResult request) throws Exception
      Commit the currently running Transaction.
      Parameters:
      transactionInfo - the JmsTransactionInfo describing the transaction being committed.
      nextTransactionInfo - the JmsTransactionInfo describing the transaction that should be started immediately.
      request - The request that will be signaled on completion of this operation.
      Throws:
      Exception - if an error occurs while performing the operation.
    • rollback

      public void rollback(JmsTransactionInfo transactionInfo, JmsTransactionInfo nextTransactionInfo, AsyncResult request) throws Exception
      Roll back the currently running Transaction
      Parameters:
      transactionInfo - the JmsTransactionInfo describing the transaction being rolled back.
      nextTransactionInfo - the JmsTransactionInfo describing the transaction that should be started immediately.
      request - The request that will be signaled on completion of this operation.
      Throws:
      Exception - if an error occurs while performing the operation.
    • schedule

      public ScheduledFuture<?> schedule(Runnable task, long delay)
      Allows a session resource to schedule a task for future execution.
      Parameters:
      task - The Runnable task to be executed after the given delay.
      delay - The delay in milliseconds to schedule the given task for execution.
      Returns:
      a ScheduledFuture instance that can be used to cancel the task.
    • addChildResource

      public void addChildResource(AmqpResource resource)
      Description copied from interface: AmqpResourceParent
      Adds the given resource as a child of this resource so that it's lifetime becomes managed by that of its parent.
      Specified by:
      addChildResource in interface AmqpResourceParent
      Parameters:
      resource - The AmqpResource that is a child of this one.
    • removeChildResource

      public void removeChildResource(AmqpResource resource)
      Description copied from interface: AmqpResourceParent
      Removes the given resource from the registered child resources managed by this one.
      Specified by:
      removeChildResource in interface AmqpResourceParent
      Parameters:
      resource - The AmqpResource that is no longer a child of this one.
    • handleResourceClosure

      public void handleResourceClosure(AmqpProvider provider, ProviderException error)
      Overrides:
      handleResourceClosure in class AmqpAbstractResource<JmsSessionInfo,org.apache.qpid.proton.engine.Session>
    • reportError

      public void reportError(ProviderException error)
      Call to send an error that occurs outside of the normal asynchronous processing of a session resource such as a remote close etc.
      Parameters:
      error - The error to forward on to the Provider error event handler.
    • getProvider

      public AmqpProvider getProvider()
      Specified by:
      getProvider in interface AmqpResourceParent
      Returns:
      a reference to the root AmqpProvider.
    • getConnection

      public AmqpConnection getConnection()
    • getSessionId

      public JmsSessionId getSessionId()
    • isTransactionInDoubt

      public boolean isTransactionInDoubt()
    • toString

      public String toString()
      Overrides:
      toString in class Object