Class OutboundSyncJobStateAggregator
java.lang.Object
de.hybris.platform.outboundsync.job.impl.OutboundSyncJobStateAggregator
- All Implemented Interfaces:
OutboundSyncJob
This aggregator keeps track of an outbound sync job by aggregating
OutboundSyncEvents indicating the job progress.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateObserver(OutboundSyncStateObserver observer) Registers an observer to be notified whenever this aggregate state changes, i.e.voidapplyEvent(@NotNull OutboundSyncEvent event) Applies an event and recalculates state of the context outbound sync job.create(@NotNull OutboundSyncCronJobModel model) Instantiates this state aggregator.Retrieves the current state of the context job.@NotNull OutboundSyncStateRetrieves state of the context job after the last event was applied.getId()Retrieves identifier of this outbound sync job.voidstop()Forces this job to stop, so that it changes its status to FINISHED, even if its state does not show that all expected items have been processed.toString()
-
Method Details
-
create
public static OutboundSyncJobStateAggregator create(@NotNull @NotNull OutboundSyncCronJobModel model) Instantiates this state aggregator.- Parameters:
model- a job model representing the cron job, for which state has to be managed by this aggregator.
-
getId
Description copied from interface:OutboundSyncJobRetrieves identifier of this outbound sync job. The default implementation in this interface always returnsPK.fromLong(0), so this method must be overridden by the implementation to provide correct behavior.- Specified by:
getIdin interfaceOutboundSyncJob- Returns:
- identifier of this job, i.e. a value that differs one outbound sync job from the other: for example, a customer synchronization from product synchronization. Therefore, this ID should persist for different executions of the same job.
-
applyEvent
Description copied from interface:OutboundSyncJobApplies an event and recalculates state of the context outbound sync job.- Specified by:
applyEventin interfaceOutboundSyncJob- Parameters:
event- a job state changing event.
-
getFinalState
Description copied from interface:OutboundSyncJobRetrieves state of the context job after the last event was applied.- Specified by:
getFinalStatein interfaceOutboundSyncJob- Returns:
- the OutboutndSyncState after the latch has been released
-
getCurrentState
Description copied from interface:OutboundSyncJobRetrieves the current state of the context job.- Specified by:
getCurrentStatein interfaceOutboundSyncJob- Returns:
- current state of the context outbound sync job.
-
addStateObserver
Registers an observer to be notified whenever this aggregate state changes, i.e. the cron job status changes, cron job result changes orStartedOutboundSyncEventwas applied.- Specified by:
addStateObserverin interfaceOutboundSyncJob- Parameters:
observer- an observer to notify
-
stop
public void stop()Description copied from interface:OutboundSyncJobForces this job to stop, so that it changes its status to FINISHED, even if its state does not show that all expected items have been processed. This means that changes processed by this job may continue being synchronized, but result of their synchronization may be ignored and not reported in the job'sPerformResultDefault implementation in this interface does nothing, meaning the job won't be stopped by default. Implementations of this interface must implement the
stop()logic.- Specified by:
stopin interfaceOutboundSyncJob
-
toString
-