Class DefaultDeleteOutboundSyncService
java.lang.Object
de.hybris.platform.outboundsync.activator.impl.DefaultDeleteOutboundSyncService
- All Implemented Interfaces:
DeleteOutboundSyncService
Default implementation of the
DeleteOutboundSyncService-
Constructor Summary
ConstructorsConstructorDescriptionDefaultDeleteOutboundSyncService(@NotNull ItemModelSearchService searchService, @NotNull OutboundItemFactory factory, @NotNull OutboundSyncJobRegister register, @NotNull DeleteRequestSender sender) Instantiates this services with its required dependenciesDefaultDeleteOutboundSyncService(@NotNull DeleteRequestSender deleteRequestSender, @NotNull ItemModelSearchService itemModelSearchService, @NotNull EventService eventService, @NotNull OutboundItemConsumer outboundItemConsumer) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected OutboundItemDTOGroupasItemGroup(OutboundItemDTO item) protected OutboundItemDTOGroupasItemGroup(Collection<OutboundItemDTO> items) protected voidconsumeChange(OutboundItemDTO item) protected voidconsumeChanges(OutboundItemDTOGroup outboundItemDTOGroup) findItemByPk(PK pk) Retrieves the change consumer used to clear changes in the delta detect module when the change is successfully synchronized or should be ignored.protected voidPublish theCompletedOutboundSyncEventwith success set to true when the synchronization is doneprotected voidpublishSystemErrorEvent(PK cronJobPk, OutboundItemDTOGroup group) Publish thenSystemErrorOutboundSyncEventif a system error occursprotected voidpublishSystemErrorEvent(PK cronJobPk, Collection<OutboundItemDTOGroup> groups) protected voidprotected voidPublish theCompletedOutboundSyncEventwith success set to false when the synchronization is donevoidsetEventService(EventService service) Injects implementation of theEventServiceto use for publishing outbound sync job events.voidsetItemModelSearchService(@NotNull ItemModelSearchService service) Deprecated, for removal: This API element is subject to removal in a future version.not preferred anymore.voidsetJobRegister(@NotNull OutboundSyncJobRegister register) Deprecated, for removal: This API element is subject to removal in a future version.not preferred anymore.voidsetOutboundItemConsumer(OutboundItemConsumer consumer) Injects a change consumer, which clears changes in the delta detect module when the change is successfully synchronized or should be ignored.voidsetOutboundItemFactory(@NotNull OutboundItemFactory factory) Deprecated, for removal: This API element is subject to removal in a future version.not preferred anymore.voidsync(OutboundItemDTO deletedItem) Synchronize the item deletionprotected voidsyncInternal(PK cronJobPk, OutboundItemDTOGroup group, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer) protected voidsyncInternal(PK cronJobPk, Collection<OutboundItemDTOGroup> groups, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer) This method checks the cronjob is in the appropriate state before calling theBaseOutboundSyncService.Synchronizer.
-
Constructor Details
-
DefaultDeleteOutboundSyncService
@Deprecated(since="2205", forRemoval=true) public DefaultDeleteOutboundSyncService(@NotNull @NotNull DeleteRequestSender deleteRequestSender, @NotNull @NotNull ItemModelSearchService itemModelSearchService, @NotNull @NotNull EventService eventService, @NotNull @NotNull OutboundItemConsumer outboundItemConsumer) Deprecated, for removal: This API element is subject to removal in a future version.useDefaultDeleteOutboundSyncService(ItemModelSearchService, OutboundItemFactory, OutboundSyncJobRegister, DeleteRequestSender)This constructor does not set theEventServiceand theOutboundItemConsumeranymore. If this constructor is used, the dependencies must be wired through the corresponding setters now.Instantiates this service- Parameters:
deleteRequestSender- Sender that sends the delete requestitemModelSearchService- Finder that retrieves an item modeleventService- Service to send events to update cronjob statusoutboundItemConsumer- Consumer that consumes the delta detect change- See Also:
-
BaseOutboundSyncService.setEventService(EventService)BaseOutboundSyncService.setOutboundItemConsumer(OutboundItemConsumer)
-
DefaultDeleteOutboundSyncService
public DefaultDeleteOutboundSyncService(@NotNull @NotNull ItemModelSearchService searchService, @NotNull @NotNull OutboundItemFactory factory, @NotNull @NotNull OutboundSyncJobRegister register, @NotNull @NotNull DeleteRequestSender sender) Instantiates this services with its required dependencies- Parameters:
searchService- a service to use for the cron job and changed item model searchesfactory- A factory implementation to create instances ofOutboundItemregister- a register to inquire about currently running outbound sync jobssender- a sender to use for sending the delete changes out
-
-
Method Details
-
sync
Description copied from interface:DeleteOutboundSyncServiceSynchronize the item deletion- Specified by:
syncin interfaceDeleteOutboundSyncService- Parameters:
deletedItem- Contains the data about the deleted item
-
syncInternal
protected void syncInternal(PK cronJobPk, Collection<OutboundItemDTOGroup> groups, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer) This method checks the cronjob is in the appropriate state before calling theBaseOutboundSyncService.Synchronizer.Here are the rules:
- If the job is aborting, an abort event is published. No synchronization will occur.
- If the job is in system error state, an system error event is published. No synchronization will occur.
- If the job is not aborted and not in system error state, synchronization will occur.
- Parameters:
cronJobPk- PK of the cronjob being executedgroups- collection of groups of items being synchronizedsynchronizer- Synchronizer to execute when the cronjob is in the appropriate state
-
syncInternal
protected void syncInternal(PK cronJobPk, OutboundItemDTOGroup group, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer) -
publishSystemErrorEvent
Publish thenSystemErrorOutboundSyncEventif a system error occurs- Parameters:
cronJobPk- PK of the cronjob being executedgroup- group of the items, for which were not processed because of a systemic problem with the outbound sync.
-
publishSystemErrorEvent
-
publishSuccessfulCompletedEvent
Publish theCompletedOutboundSyncEventwith success set to true when the synchronization is done- Parameters:
group- a group of items successfully synchronized
-
publishUnSuccessfulCompletedEvent
Publish theCompletedOutboundSyncEventwith success set to false when the synchronization is done- Parameters:
groups- a group of items that failed to be synchronized
-
publishUnSuccessfulCompletedEvent
-
findItemByPk
-
asItemGroup
-
asItemGroup
-
consumeChanges
-
consumeChange
-
setOutboundItemFactory
@Deprecated(since="2205", forRemoval=true) public void setOutboundItemFactory(@NotNull @NotNull OutboundItemFactory factory) Deprecated, for removal: This API element is subject to removal in a future version.not preferred anymore. If the dependency is needed it should be injected into the concrete service class.Injects implementation of theOutboundItemFactoryto be passed into theOutboundItemDTOGroupcreated by this service.- Parameters:
factory- an implementation of the outbound item factory to be used in this service
-
getOutboundItemConsumer
Retrieves the change consumer used to clear changes in the delta detect module when the change is successfully synchronized or should be ignored.- Returns:
- changes consumer user by this service
-
setOutboundItemConsumer
Injects a change consumer, which clears changes in the delta detect module when the change is successfully synchronized or should be ignored. If item consumer is not injected, the changes won't be consumed and therefore custom implementation need to manage delta detect changes themselves.- Parameters:
consumer- an implementation of the change consumer to use.
-
setEventService
Injects implementation of theEventServiceto use for publishing outbound sync job events. If the event services is not injected, the outbound sync events won't be fired. Although, this dependency is optional, current implementation of the outbound sync heavily relies on the outbound sync events being fired. If a customization, decides not to inject this service, it has to manage events delivery toOutboundSyncJobStateAggregatorin a customer way to maintain correct functionality.- Parameters:
service- a service to use for publishing events
-
setItemModelSearchService
@Deprecated(since="2205", forRemoval=true) public void setItemModelSearchService(@NotNull @NotNull ItemModelSearchService service) Deprecated, for removal: This API element is subject to removal in a future version.not preferred anymore. Inject theItemModelSearchServicethrough constructorInjects implementation of theItemModelSearchServiceto be used for searching model instances by PK. If this method is not called then,ItemModelSearchServiceconfigured in"itemModelSearchService"Spring bean will be used by default.- Parameters:
service- an implementation to use.
-
setJobRegister
@Deprecated(since="2205", forRemoval=true) public void setJobRegister(@NotNull @NotNull OutboundSyncJobRegister register) Deprecated, for removal: This API element is subject to removal in a future version.not preferred anymore. Inject theOutboundSyncJobRegisterthrough constructorInjects specificOutboundSyncJobRegisterimplementation.- Parameters:
register- an implementation to use
-
DefaultDeleteOutboundSyncService(ItemModelSearchService, OutboundItemFactory, OutboundSyncJobRegister, DeleteRequestSender)This constructor does not set theEventServiceand theOutboundItemConsumeranymore.