Package org.apache.qpid.protonj2.engine
Interface TransactionManager
- All Superinterfaces:
- Endpoint<TransactionManager>
- All Known Implementing Classes:
- ProtonTransactionManager
Transaction Manager endpoint that implements the mechanics of handling the declaration
 of and the requested discharge of AMQP transactions.  Typically an AMQP server instance
 will host the transaction management services that are used by client resources to declare
 and discharge transaction and handle the associated of deliveries that are enlisted in
 active transactions.
- 
Method SummaryModifier and TypeMethodDescriptionaddCredit(int additionalCredit) Adds the given amount of credit for theTransactionManagerwhich allows theTransactionControllerto sendDeclareandDischargerequests to this manager.default TransactionManagerdeclared(Transaction<TransactionManager> transaction, byte[] txnId) Respond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction has been successfully declared and that deliveries can now be enlisted in that transaction.declared(Transaction<TransactionManager> transaction, Binary txnId) Respond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction has been successfully declared and that deliveries can now be enlisted in that transaction.declareFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Respond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction declaration has failed and is not active.declareHandler(EventHandler<Transaction<TransactionManager>> declaredEventHandler) Called when theTransactionControllerend of the link has requested a new transaction be declared using the information provided in the givenDeclareinstance.discharged(Transaction<TransactionManager> transaction) Respond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge completed on the transaction identified by given transaction Id has now been retired.dischargeFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Respond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge resulted in an error and the transaction must be considered rolled back.dischargeHandler(EventHandler<Transaction<TransactionManager>> dischargeEventHandler) Called when theTransactionControllerend of the link has requested a current transaction be discharged using the information provided in the givenDischargeinstance.Returns the currently set Coordinator target for thisLink.intGet the credit that is currently available or assigned to thisTransactionManager.Returns the remote targetTerminusfor this transaction manager which must be of typeCoordinatoror null if remote did not set a terminus.Sets aEventHandlerfor when the parentSessionorConnectionof thisTransactionManageris locally closed.setCoordinator(Coordinator coordinator) Sets theCoordinatortarget to assign to the local end of thisTransactionManager.Sets theSourceto assign to the local end of thisTransactionManager.Methods inherited from interface org.apache.qpid.protonj2.engine.Endpointclose, closeHandler, engineShutdownHandler, getAttachments, getCondition, getDesiredCapabilities, getEngine, getLinkedResource, getLinkedResource, getOfferedCapabilities, getParent, getProperties, getRemoteCondition, getRemoteDesiredCapabilities, getRemoteOfferedCapabilities, getRemoteProperties, isLocallyClosed, isLocallyOpen, isRemotelyClosed, isRemotelyOpen, localCloseHandler, localOpenHandler, open, openHandler, setCondition, setDesiredCapabilities, setLinkedResource, setOfferedCapabilities, setProperties
- 
Method Details- 
addCreditAdds the given amount of credit for theTransactionManagerwhich allows theTransactionControllerto sendDeclareandDischargerequests to this manager. TheTransactionControllercannot send any requests to start or complete a transaction without having credit to do so which implies that theTransactionManagerowner must grant credit as part of its normal processing.- Parameters:
- additionalCredit- the new amount of credits to add.
- Returns:
- this TransactionManager
- Throws:
- IllegalArgumentException- if the credit amount is negative.
 
- 
getCreditint getCredit()Get the credit that is currently available or assigned to thisTransactionManager.- Returns:
- the current unused credit.
 
- 
setSourceSets theSourceto assign to the local end of thisTransactionManager. Must be called during setup, i.e. before calling theEndpoint.open()method.- Parameters:
- source- The- Sourcethat will be set on the local end of this transaction controller.
- Returns:
- this transaction controller instance.
- Throws:
- IllegalStateException- if the- TransactionManagerhas already been opened.
 
- 
getSourceSource getSource()- Returns:
- the Sourcefor the local end of thisTransactionController.
 
- 
setCoordinatorSets theCoordinatortarget to assign to the local end of thisTransactionManager. Must be called during setup, i.e. before calling theEndpoint.open()method.- Parameters:
- coordinator- The- Coordinatortarget that will be set on the local end of this transaction controller.
- Returns:
- this transaction controller instance.
- Throws:
- IllegalStateException- if the- TransactionManagerhas already been opened.
 
- 
getCoordinatorCoordinator getCoordinator()Returns the currently set Coordinator target for thisLink.- Returns:
- the link target Coordinatorfor the local end of this link.
 
- 
getRemoteSourceSource getRemoteSource()- Returns:
- the source Sourcefor the remote end of thisTransactionManager.
 
- 
getRemoteCoordinatorCoordinator getRemoteCoordinator()Returns the remote targetTerminusfor this transaction manager which must be of typeCoordinatoror null if remote did not set a terminus.- Returns:
- the remote coordinator Terminusfor the remote end of this link.
 
- 
declaredRespond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction has been successfully declared and that deliveries can now be enlisted in that transaction.- Parameters:
- transaction- The transaction instance that is associated with the declared transaction.
- txnId- The binary transaction Id to assign the now declared transaction instance.
- Returns:
- this TransactionManager.
 
- 
declaredRespond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction has been successfully declared and that deliveries can now be enlisted in that transaction.- Parameters:
- transaction- The transaction instance that is associated with the declared transaction.
- txnId- The binary transaction Id to assign the now declared transaction instance.
- Returns:
- this TransactionManager.
 
- 
declareFailedTransactionManager declareFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Respond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction declaration has failed and is not active.- Parameters:
- transaction- The transaction instance that is associated with the declared transaction.
- condition- The- ErrorConditionthat described the reason for the transaction failure.
- Returns:
- this TransactionManager.
 
- 
dischargedRespond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge completed on the transaction identified by given transaction Id has now been retired.- Parameters:
- transaction- The- Transactioninstance that has been discharged and is now retired.
- Returns:
- this TransactionManager.
 
- 
dischargeFailedTransactionManager dischargeFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Respond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge resulted in an error and the transaction must be considered rolled back.- Parameters:
- transaction- The- Transactioninstance that has been discharged and is now retired.
- condition- The- ErrorConditionthat described the reason for the transaction failure.
- Returns:
- this TransactionManager.
 
- 
declareHandlerTransactionManager declareHandler(EventHandler<Transaction<TransactionManager>> declaredEventHandler) Called when theTransactionControllerend of the link has requested a new transaction be declared using the information provided in the givenDeclareinstance.- Parameters:
- declaredEventHandler- handler that will act on the transaction declaration request.
- Returns:
- this TransactionManager.
 
- 
dischargeHandlerTransactionManager dischargeHandler(EventHandler<Transaction<TransactionManager>> dischargeEventHandler) Called when theTransactionControllerend of the link has requested a current transaction be discharged using the information provided in the givenDischargeinstance.- Parameters:
- dischargeEventHandler- handler that will act on the transaction declaration request.
- Returns:
- this TransactionManager.
 
- 
parentEndpointClosedHandlerSets aEventHandlerfor when the parentSessionorConnectionof thisTransactionManageris locally closed. Typically used by clients for logging or other state update event processing. Clients should not perform any blocking calls within this context. It is an error for the handler to throw an exception and the outcome of doing so is undefined.- Parameters:
- handler- The- EventHandlerto notify when this transaction manger's parent endpoint is locally closed.
- Returns:
- the link for chaining.
 
 
-