Package com.commercetools.sync.commons
Class CleanupUnresolvedReferenceCustomObjects
- java.lang.Object
-
- com.commercetools.sync.commons.CleanupUnresolvedReferenceCustomObjects
-
public final class CleanupUnresolvedReferenceCustomObjects extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CleanupUnresolvedReferenceCustomObjects.Statistics
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<CleanupUnresolvedReferenceCustomObjects.Statistics>
cleanup(int deleteDaysAfterLastModification)
Deletes the unresolved reference custom objects persisted by commercetools-sync-java library to handle reference resolution.CleanupUnresolvedReferenceCustomObjects
errorCallback(java.util.function.Consumer<java.lang.Throwable> errorCallback)
Sets theerrorCallback
function of the cleanup.static CleanupUnresolvedReferenceCustomObjects
of(com.commercetools.api.client.ProjectApiRoot ctpClient)
Creates new instance ofCleanupUnresolvedReferenceCustomObjects
which has the functionality to run cleanup helpers.CleanupUnresolvedReferenceCustomObjects
pageSize(int pageSize)
Configures the pageSize (limit), the maximum number of results to return from the grapqhl query, which can be set using the limit query parameter.
-
-
-
Method Detail
-
of
public static CleanupUnresolvedReferenceCustomObjects of(@Nonnull com.commercetools.api.client.ProjectApiRoot ctpClient)
Creates new instance ofCleanupUnresolvedReferenceCustomObjects
which has the functionality to run cleanup helpers.- Parameters:
ctpClient
- the client object.- Returns:
- new instance of
CleanupUnresolvedReferenceCustomObjects
-
errorCallback
public CleanupUnresolvedReferenceCustomObjects errorCallback(@Nonnull java.util.function.Consumer<java.lang.Throwable> errorCallback)
Sets theerrorCallback
function of the cleanup. This callback will be called whenever an event occurs that leads to an error alert from the cleanup process.- Parameters:
errorCallback
- the new value to set to the error callback.- Returns:
this
instance ofBaseSyncOptionsBuilder
-
pageSize
public CleanupUnresolvedReferenceCustomObjects pageSize(int pageSize)
Configures the pageSize (limit), the maximum number of results to return from the grapqhl query, which can be set using the limit query parameter. The default page size is 500.NOTE: Changing this value might negatively impact the performance of the cleanup and must be tested properly.
- Parameters:
pageSize
- int that indicates batch size of resources to process.- Returns:
this
instance ofBaseSyncOptionsBuilder
-
cleanup
public java.util.concurrent.CompletableFuture<CleanupUnresolvedReferenceCustomObjects.Statistics> cleanup(int deleteDaysAfterLastModification)
Deletes the unresolved reference custom objects persisted by commercetools-sync-java library to handle reference resolution. The custom objects will be deleted if it hasn't been modified for the specified amount of days as givendeleteDaysAfterLastModification
.Note: Keeping the unresolved references forever can negatively influence the performance of your project, so deleting unused data ensures the best performance for your project.
- Parameters:
deleteDaysAfterLastModification
- Days to query. The custom objects will be deleted if it hasn't been modified for the specified amount of days.- Returns:
- an instance of
CompletableFuture
<CleanupUnresolvedReferenceCustomObjects.Statistics
> which contains the processing time, the total number of custom objects that were deleted and failed to delete, and a proper summary message of the statistics.
-
-