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
Constructors Constructor Description AmqpSession(AmqpConnection connection, JmsSessionInfo info, org.apache.qpid.proton.engine.Session session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledge(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)AmqpConnectiongetConnection()AmqpConsumergetConsumer(JmsConsumerInfo consumerInfo)AmqpProducergetProducer(JmsProducerInfo producerInfo)AmqpProvidergetProvider()JmsSessionIdgetSessionId()AmqpTransactionContextgetTransactionContext()voidhandleResourceClosure(AmqpProvider provider, ProviderException error)booleanisTransactionInDoubt()voidrecover()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 TransactionScheduledFuture<?>schedule(Runnable task, long delay)Allows a session resource to schedule a task for future execution.StringtoString()-
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 Detail
-
AmqpSession
public AmqpSession(AmqpConnection connection, JmsSessionInfo info, org.apache.qpid.proton.engine.Session session)
-
-
Method Detail
-
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 ExceptionPerform 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: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
public void removeChildResource(AmqpResource resource)
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
public void handleResourceClosure(AmqpProvider provider, ProviderException error)
- Overrides:
handleResourceClosurein classAmqpAbstractResource<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:
getProviderin interfaceAmqpResourceParent- Returns:
- a reference to the root AmqpProvider.
-
getConnection
public AmqpConnection getConnection()
-
getSessionId
public JmsSessionId getSessionId()
-
isTransactionInDoubt
public boolean isTransactionInDoubt()
-
-