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
-
Field Summary
Fields inherited from class org.apache.qpid.jms.provider.amqp.AmqpAbstractResource
closeRequest, closeTimeoutTask -
Constructor Summary
ConstructorsConstructorDescriptionAmqpSession(AmqpConnection connection, JmsSessionInfo info, org.apache.qpid.proton.engine.Session session) -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(ProviderConstants.ACK_TYPE ackType) Perform an acknowledge of all delivered messages for all consumers active in this Session.voidaddChildResource(AmqpResource resource) Adds the given resource as a child of this resource so that it's lifetime becomes managed by that of its parent.voidbegin(JmsTransactionId txId, AsyncResult request) Begins a new Transaction using the given Transaction Id as the identifier.voidcommit(JmsTransactionInfo transactionInfo, JmsTransactionInfo nextTransactionInfo, AsyncResult request) Commit the currently running Transaction.voidcreateConsumer(JmsConsumerInfo consumerInfo, AsyncResult request) voidcreateProducer(JmsProducerInfo producerInfo, AsyncResult request) getConsumer(JmsConsumerInfo consumerInfo) getProducer(JmsProducerInfo producerInfo) voidhandleResourceClosure(AmqpProvider provider, ProviderException error) booleanvoidrecover()Perform re-send of all delivered but not yet acknowledged messages for all consumers active in this Session.voidremoveChildResource(AmqpResource resource) Removes the given resource from the registered child resources managed by this one.voidreportError(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.voidrollback(JmsTransactionInfo transactionInfo, JmsTransactionInfo nextTransactionInfo, AsyncResult request) Roll back the currently running TransactionAllows a session resource to schedule a task for future execution.toString()Methods inherited from class org.apache.qpid.jms.provider.amqp.AmqpAbstractResource
close, closeOrDetachEndpoint, closeResource, getEndpoint, getLocalState, getParent, getRemoteState, getResourceInfo, isAwaitingClose, isClosed, isOpen, processDeliveryUpdates, processFlowUpdates, processRemoteClose, processRemoteDetach, processRemoteOpen
-
Constructor Details
-
AmqpSession
public AmqpSession(AmqpConnection connection, JmsSessionInfo info, org.apache.qpid.proton.engine.Session session)
-
-
Method Details
-
acknowledge
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
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
-
getProducer
-
createConsumer
-
getConsumer
-
getTransactionContext
-
begin
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
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
Description copied from interface:AmqpResourceParentAdds the given resource as a child of this resource so that it's lifetime becomes managed by that of its parent.- Specified by:
addChildResourcein interfaceAmqpResourceParent- Parameters:
resource- The AmqpResource that is a child of this one.
-
removeChildResource
Description copied from interface:AmqpResourceParentRemoves the given resource from the registered child resources managed by this one.- Specified by:
removeChildResourcein interfaceAmqpResourceParent- Parameters:
resource- The AmqpResource that is no longer a child of this one.
-
handleResourceClosure
- Overrides:
handleResourceClosurein classAmqpAbstractResource<JmsSessionInfo,org.apache.qpid.proton.engine.Session>
-
reportError
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
- Specified by:
getProviderin interfaceAmqpResourceParent- Returns:
- a reference to the root AmqpProvider.
-
getConnection
-
getSessionId
-
isTransactionInDoubt
public boolean isTransactionInDoubt() -
toString
-