cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Custom cleanup extension

nkjahan1388
Explorer
0 Likes
490

We are using Hybris 6.6 and noticed that some of the raw and canonical items are not deleted inspite of being published successfully. Also there are some canonical items which are just intermediate objects and not the canonical item source for any of the target items. Hence these are not being deleted. Need help in custom implementation of the cleanup functionality.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

In order to Build Custom Cleanup logic you need to create or reuse an extension and Implement the following Interface: CleanupExtensionHandler.

 /**
  * defines the cleanup hooks to be implemented by custom cleanup extension if needed
  */
 public interface CleanupExtensionHandler
 {
     /**
      * Defines behaviour to execute before given Cleanup logic.
      * @param context
      */
     public void beforeCleanup(final CleanupContext context);
 
     /**
      * Defines behaviour to execute after given Cleanup logic.
      * @param context
      */
     public void afterCleanup(final CleanupContext context);
 
     /**
      * Determines whether this handler is applicable to the context.
      * @param context
      * @return true if handler should be executed in this context
      */
     public boolean isApplicable(final CleanupContext context);
 }

Your implementation will be called before and after cleanup. Also you can specify if your Implementation is applicable for a given CleanupContext. E.g. which event triggered this call.

nkjahan1388
Explorer
0 Likes

Thanks ! I was thinking of overriding the listeners (AbstractJdbcDataHubEventListener) for composition/publication events and modify the delete query to fetch objects for deletion as per the criteria I specify. This way I can delete the Canonical objects which dont have an entry in CanItemPubStatus table as well. Any thoughts in this regard?

Former Member
0 Likes

I would recommend to to Use CleanupExtensionHandler and leave the listeners as they are in order to avoid messing up with the fine tuned queries for regular delets. But you can surely use the AbstractJdbcCleanupService as a reference implementation.

Former Member
0 Likes

Hi kauser,

use below properties in dataub local.properties file :

datahub.cleanup.rawitem.enabled=true

datahub.cleanup.canonicalitem.enabled=true

datahub.cleanup.targetitem.enabled=true

datahub.cleanup.publisheditems.enabled=true