Search code examples
upgradesap-commerce-cloud

Synchronization of multiple catalogs in hybris


I need help on this issue. I am upgrading hybris to version 2105, I ran into the problem that the 'DefaultSetupSyncJobService' class has changed its methods from 'SyncItemJob' to 'SyncItemJobModel'. How could I adapt these classes so that the catalogs are correctly synchronized ?


Solution

  • The new implementation for synchronization is stored in CatalogSynchronizationService.synchronizeFully(source,target) for a full synchronization. There are other methods to perform partial syncs with a select subset of items aswell in that service.

    Do note that this will always create new SyncItemCronJobModel objects instead of reusing an existing syncjob. Depending on what you want, you can modify the implementation somewhat to reuse the same syncjob. The code then becomes something like this:

    catalogSynchronizationService.getSyncJob(source, target, null);
    

    instead of calling createSyncItemJob(...)

    The rest is the same as the original implementation. So customized implementation of synchronizeFully could look something like(Extend from DefaultCatalogSynchronizationService)

    public void synchronizeFully(final CatalogVersionModel source, final CatalogVersionModel target) {
        final SyncItemJobModel syncJob = getSyncJob(source, target, null);
        final SyncItemCronJobModel syncCronJob = createSyncCronJob(syncJob);
    
        cronJobService.performCronJob(syncCronJob, true);
    }