Search in sources :

Example 1 with PayloadGroup

use of com.adobe.acs.commons.workflow.bulk.execution.model.PayloadGroup in project acs-aem-commons by Adobe-Consulting-Services.

the class AbstractAEMWorkflowRunner method onboardNextPayload.

@SuppressWarnings("squid:S3776")
protected Payload onboardNextPayload(Workspace workspace) {
    long start = System.currentTimeMillis();
    for (PayloadGroup payloadGroup : workspace.getActivePayloadGroups()) {
        Payload payload = payloadGroup.getNextPayload();
        if (payload != null && !payload.isOnboarded()) {
            // Onboard this payload as it hasnt been onboarded yet
            workspace.addActivePayload(payload);
            if (log.isTraceEnabled()) {
                log.trace("Took {} ms to onboard next payload", System.currentTimeMillis() - start);
            }
            return payload;
        }
    }
    // No payloads in the active payload groups are eligible for onboarding
    PayloadGroup nextPayloadGroup = null;
    for (PayloadGroup payloadGroup : workspace.getActivePayloadGroups()) {
        nextPayloadGroup = onboardNextPayloadGroup(workspace, payloadGroup);
        if (nextPayloadGroup != null) {
            Payload payload = nextPayloadGroup.getNextPayload();
            if (payload == null) {
                continue;
            // all done! empty group
            } else {
                workspace.addActivePayload(payload);
            }
            if (log.isTraceEnabled()) {
                log.trace("Onboarded [ {} ] in {} ms", payload.getPayloadPath(), System.currentTimeMillis() - start);
            }
            return payload;
        }
    }
    return null;
}
Also used : PayloadGroup(com.adobe.acs.commons.workflow.bulk.execution.model.PayloadGroup) Payload(com.adobe.acs.commons.workflow.bulk.execution.model.Payload)

Aggregations

Payload (com.adobe.acs.commons.workflow.bulk.execution.model.Payload)1 PayloadGroup (com.adobe.acs.commons.workflow.bulk.execution.model.PayloadGroup)1