Service - Import Data
Jump to navigation
Jump to search
Process
ProcessPendingLinks:
- count DynamoDB records for PendingObjectMain and PendingLinks and save in ImportBatchMain table
- iterate all PendingLink records:
- check referenceId has a valid record in PendingObjectReference
- check linkTag is valid (objectId is the child, referenceId object is the parent)
- if linkType is Dependent:
- if separateDependentLinkCreate false and child exist add error
- save (DependentPendingObject)awaitingMultipleSteps for the child object, waiting for the parent object to be created (multiple so can handle multiple parents for this child)
- save (DependentPendingLink)awaitingStep for the PendingLink, waiting for the child object to be created
- if linkType is Independent, save (IndependentPendingLink)awaitingMultipleSteps for the PendingLink, waiting for both child and parent to be created
- save this PendingLink into (ImportBatchMain)awaitingMultipleSteps for ImportBatchMain
- if any errors found prior to this step stop processing and mark feed as status error, remove any saved awaitingMultipleSteps
ProcessPendingObjects:
- iterate all PendingObjectMain records
- save this PendingObjectMain into (ImportBatchMain)awaitingMultipleSteps for ImportBatchMain
- iterate any PendingLinks that have this object as the child (use Dynamo startsWith on pendingLinkId field)
- if linkType is Dependent, stop processing this PendingObjectMain record (already have awaitingMultipleSteps saved)
- if PendingObjectMain exist:
- set status of PendingObjectMain to "complete"
- do PendingObjectComplete lib
- if PendingObjectMain not exist:
- set status of PendingObjectMain to "creating"
- send to external service to create
After external service creates object:
- sets status of PendingObjectMain to "complete", add object identifier ids to PendingObjectMain record
- do PendingObjectComplete lib
PendingObjectComplete lib:
- remove (ImportBatchMain)awaitingMultipleSteps for ImportBatchMain
- iterate any Dependent (DependentPendingObject)awaitingMultipleSteps
- find the child object that was waiting this parent
- check if that child object has any remaining (DependentPendingObject)awaitingMultipleSteps, if no then:
- find all Dependent pendingLinks for this child object (using Dynamo BeginsWith)
- if child object exist:
- set status of child object to "complete"
- do PendingObjectComplete lib
- if child object not exist:
- send message to external service to create child object
- include in message to external service to create child object all parent object identifier ids
- set status of child PendingObjectMain to "creating"
- iterate any Dependent PendingLink (DependentPendingLink)awaitingStep
- if pendingLink separateDependentLinkCreate = false(default):
- sets status of PendingLink to "complete"
- remove (ImportBatchMain)awaitingMultipleSteps for ImportBatchMain
- if pendingLink separateDependentLinkCreate = true:
- set status of PendingLink to "creating"
- send to external service to create link, including object identifier ids of both objects
- if pendingLink separateDependentLinkCreate = false(default):
- iterate any Independent (IndependentPendingLink)awaitingMultipleSteps
- check any remaining awaitingMultipleSteps for that PendingLink, if no then:
- set status of PendingLink to "creating"
- send to external service to create link, including object identifier ids of both objects
- check any remaining awaitingMultipleSteps for that PendingLink, if no then:
After external service creates link:
- sets status of PendingLink to "complete"
- remove (ImportBatchMain)awaitingMultipleSteps for ImportBatchMain
When removing (ImportBatchMain)awaitingMultipleSteps for ImportBatchMain (both PendingObjectMain and PendingLink)
- check if any remain, if not then set ImportBatchMain to complete and send ImportBatchMainComplete message