Class CleanupUnresolvedReferenceCustomObjects


  • public final class CleanupUnresolvedReferenceCustomObjects
    extends java.lang.Object
    • Method Detail

      • errorCallback

        public CleanupUnresolvedReferenceCustomObjects errorCallback​(@Nonnull
                                                                     java.util.function.Consumer<java.lang.Throwable> errorCallback)
        Sets the errorCallback 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 of BaseSyncOptionsBuilder
      • 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 of BaseSyncOptionsBuilder
      • 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 given deleteDaysAfterLastModification.

        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.