Interface BulkUpdateProcessor<P>
-
- Type Parameters:
P
- the business-domain type of the records this processor can filter by. While the basic filtration can only be applied to a single domain, the logic inmodifyAndPersist(List, BulkUpdate)
can query/update additional domains that need to be adjusted as part of the update.
public interface BulkUpdateProcessor<P>
WhileBulkUpdateManager
is responsible for most of the coordination during a bulk update, it will delegate to aBulkUpdateProcessor
for operations that are specific to theBulkUpdate.target
andBulkUpdate.type
.Generally speaking, there should be one
BulkUpdateProcessor
registered for eachBulkUpdate.target
that needs to be supported, and inside of it there should be implementations for each desiredBulkUpdate.type
on thatBulkUpdate.target
.The
BulkUpdateManager
will use only the firstBulkUpdateProcessor
for whichcanHandle(BulkUpdate)
returns true.- Author:
- Samarth Dhruva (samarthd)
- See Also:
BulkUpdateManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canHandle(BulkUpdate bulkUpdate)
Returns whether this processor can support performing the given bulk update operation.BatchProcessResponse
modifyAndPersist(List<P> batchToProcess, BulkUpdate bulkUpdate)
Accepts a list of objects - this will be a batch subset of the full results returned inreadRecordsToProcess(BulkUpdate)
.ReadRecordsResponse<P>
readRecordsToProcess(BulkUpdate bulkUpdate)
Returns the full stream of records from the data store that should be processed.
-
-
-
Method Detail
-
canHandle
boolean canHandle(BulkUpdate bulkUpdate)
Returns whether this processor can support performing the given bulk update operation. Generally this should be entirely based onBulkUpdate.target
andBulkUpdate.type
.- Parameters:
bulkUpdate
- the update that needs to be processed- Returns:
- true if the processor can support performing the bulk update operation, false otherwise
-
readRecordsToProcess
ReadRecordsResponse<P> readRecordsToProcess(BulkUpdate bulkUpdate)
Returns the full stream of records from the data store that should be processed.Implementations should utilize
BulkUpdate.filterString
,BulkUpdate.inclusions
, andBulkUpdate.exclusions
to filter/include results. A reasonable implementation could have the following rules:- If
filterString
is blank andinclusions
is not empty, only the entities specified ininclusions
will be returned (minus anyexclusions
). - If
filterString
is blank andinclusions
is empty, all entities in the data store will be returned (minus anyexclusions
). - If
filterString
is not blank, then all entities matching the filters and any entities specified ininclusions
will be returned (minus anyexclusions
).
- Parameters:
bulkUpdate
- the update that is being processed- Returns:
- a
ReadRecordsResponse
containing the full stream of records from the data store that should be processed, withfilterString
,inclusions
, andexclusions
already accounted for - See Also:
BulkUpdate.filterString
,BulkUpdate.inclusions
,BulkUpdate.exclusions
- If
-
modifyAndPersist
BatchProcessResponse modifyAndPersist(List<P> batchToProcess, BulkUpdate bulkUpdate)
Accepts a list of objects - this will be a batch subset of the full results returned inreadRecordsToProcess(BulkUpdate)
. Then,BulkUpdate.serializedPayload
and context information (such asBulkUpdate.updatingSandboxId
,BulkUpdate.updatingApplicationId
,BulkUpdate.updatingCatalogId
) should be used to apply the necessary modifications and persist the results.This method is called multiple times - once for each batch until all records are processed.
- Parameters:
batchToProcess
- a list of records to update and persist. The maximum size of this list is defined byBulkUpdateProcessingConfigurationProperties.batchSize
.bulkUpdate
- the update that is being processed- Returns:
- a response describing whether the processing of the batch succeeded/failed
-
-