TransactionContext Class
- java.
lang. Object - com.
microsoft. azure. servicebus. TransactionContext
- com.
public class TransactionContext
Represents an active servicebus transaction. A transaction is initiated by calling startTransactionAsync(). A transaction can result in commit or rollback. To commit, call endTransactionAsync(TransactionContext transaction, boolean commit) with To rollback, call endTransactionAsync(TransactionContext transaction, boolean commit) with
Field Summary
Modifier and Type | Field and Description |
---|---|
Transaction |
NULL_TXN |
Constructor Summary
Constructor | Description | |
---|---|---|
TransactionContext(ByteBuffer txnId, MessagingFactory messagingFactory) |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commits the transaction |
CompletableFuture<Void> |
commitAsync()
Asynchronously commits the transaction |
ByteBuffer |
getTransactionId()
Represents the service-side transactionID |
void |
notifyTransactionCompletion(boolean commit)
This is not to be called by the user. |
void |
rollback()
Rollback the transaction |
CompletableFuture<Void> |
rollbackAsync()
Asynchronously rollback the transaction. |
String | toString() |
Field Details
NULL_TXN
public static TransactionContext NULL_TXN= new TransactionContext(null, null)
Constructor Details
TransactionContext
public TransactionContext(ByteBuffer txnId, MessagingFactory messagingFactory)
Parameters:
Method Details
commit
public void commit()
Commits the transaction
Throws:
commitAsync
public CompletableFuture
Asynchronously commits the transaction
Returns:
getTransactionId
public ByteBuffer getTransactionId()
Represents the service-side transactionID
Returns:
notifyTransactionCompletion
public void notifyTransactionCompletion(boolean commit)
This is not to be called by the user.
Parameters:
rollback
public void rollback()
Rollback the transaction
Throws:
rollbackAsync
public CompletableFuture
Asynchronously rollback the transaction.
Returns:
toString
public String toString()
Applies to
Azure SDK for Java