public abstract class BaseBatchTransactionContextWrapper extends Object implements BatchTransactionContext
BatchTransactionContext
This implementation delegates all of its methods into a delegate received in the constructor, including equals(Object)
and hashCode().
Because this implementation delegates all the methods, implementations only need to override the methods which intercepting is
necessary| Modifier and Type | Field and Description |
|---|---|
protected BatchTransactionContext |
delegate |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseBatchTransactionContextWrapper(BatchTransactionContext delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
ackProcessedRecords(int howMany)
reports that
howMany records were successfully processed in this context (by successfully I mean without incidents. |
void |
ackSingleRecordProcessed()
reports that one record has been successfully processed in this context (by successfully I mean without incidents.
|
void |
beginTransaction()
Starts the transaction
|
void |
commit()
Commits the transaction
|
boolean |
equals(Object obj) |
int |
getBlockSize() |
Serializable |
getId()
Returns an unmodifiable id associated to this particular instance
|
BatchJobAdapter |
getJob()
Returns the
BatchJobAdapter for which this context was built |
BatchJobInstanceAdapter |
getJobInstance()
Returns the
BatchJobInstanceAdapter for which this context was built |
org.mule.runtime.core.api.util.queue.Queue |
getQueue(String name)
Returns a
Queue attached to the current transaction |
CompletableFuture<Void> |
getResolutionCallback()
A
CompletableFuture which is completed when the transaction is resolved. |
int |
hashCode() |
boolean |
isBlockCompleted()
Returns
true if the total amount of acknowledged records through the BatchTransactionContext.ackProcessedRecords(int) matches the
block size. |
void |
rollback()
Rolls the transaction back
|
void |
setBlockSize(int size)
Sets the size of the record block this transaction is processingh
|
void |
updateJobInstance(BatchJobInstanceAdapter jobInstance)
Refreshes the state of the related
BatchJobInstanceAdapter |
protected final BatchTransactionContext delegate
protected BaseBatchTransactionContextWrapper(BatchTransactionContext delegate)
public void ackProcessedRecords(int howMany)
BatchTransactionContexthowMany records were successfully processed in this context (by successfully I mean without incidents.
The record might have failed or not, we don't care).
This method works in tandem with BatchTransactionContext.setBlockSize(int) and BatchTransactionContext.getBlockSize().ackProcessedRecords in interface BatchTransactionContexthowMany - the number of records that have been acknowledgedpublic void ackSingleRecordProcessed()
BatchTransactionContextBatchTransactionContext.ackProcessedRecords(int) with the number one as an argumentackSingleRecordProcessed in interface BatchTransactionContextpublic boolean isBlockCompleted()
BatchTransactionContexttrue if the total amount of acknowledged records through the BatchTransactionContext.ackProcessedRecords(int) matches the
block size. Although it's not mandatory, you should call BatchTransactionContext.commit() when this method returns trueisBlockCompleted in interface BatchTransactionContexttrue if all the Records in the block were acknowledged. false otherwisepublic void beginTransaction()
throws org.mule.runtime.core.api.transaction.xa.ResourceManagerException
BatchTransactionContextbeginTransaction in interface BatchTransactionContextorg.mule.runtime.core.api.transaction.xa.ResourceManagerExceptionpublic void commit()
throws org.mule.runtime.core.api.transaction.xa.ResourceManagerException
BatchTransactionContextcommit in interface BatchTransactionContextorg.mule.runtime.core.api.transaction.xa.ResourceManagerExceptionpublic void rollback()
throws org.mule.runtime.core.api.transaction.xa.ResourceManagerException
BatchTransactionContextrollback in interface BatchTransactionContextorg.mule.runtime.core.api.transaction.xa.ResourceManagerExceptionpublic Serializable getId()
BatchTransactionContextgetId in interface BatchTransactionContextSerializable idpublic BatchJobAdapter getJob()
BatchTransactionContextBatchJobAdapter for which this context was builtgetJob in interface BatchTransactionContextnull BatchJobAdapterpublic BatchJobInstanceAdapter getJobInstance()
BatchTransactionContextBatchJobInstanceAdapter for which this context was builtgetJobInstance in interface BatchTransactionContextnull BatchJobInstanceAdapterpublic org.mule.runtime.core.api.util.queue.Queue getQueue(String name)
BatchTransactionContextQueue attached to the current transactiongetQueue in interface BatchTransactionContextname - the name of the Queue you wantnull Queuepublic int getBlockSize()
getBlockSize in interface BatchTransactionContextpublic void updateJobInstance(BatchJobInstanceAdapter jobInstance)
BatchTransactionContextBatchJobInstanceAdapterupdateJobInstance in interface BatchTransactionContextjobInstance - a not null BatchJobInstanceAdapterpublic void setBlockSize(int size)
BatchTransactionContextsetBlockSize in interface BatchTransactionContextsize - the size of the record block this transaction is processingpublic CompletableFuture<Void> getResolutionCallback()
BatchTransactionContextCompletableFuture which is completed when the transaction is resolved. The future will be completed successfully
regardless of the transaction been committed or rolled back.
This will never complete if BatchTransactionContext.beginTransaction() is never invoked.
getResolutionCallback in interface BatchTransactionContextCompletableFutureCopyright © 2006–2022 MuleSoft, Inc.. All rights reserved.