Class DeploymentJobSchedulingRequestCompletionHandler
java.lang.Object
com.broadleafcommerce.sandbox.messaging.completion.DeploymentJobSchedulingRequestCompletionHandler
- All Implemented Interfaces:
WorkflowRequestCompletionHandler
public class DeploymentJobSchedulingRequestCompletionHandler
extends Object
implements WorkflowRequestCompletionHandler
This handler deals with updating the states and statuses of
ChangeDeploys
that have just finished being scheduled.-
Constructor Summary
ConstructorsConstructorDescriptionDeploymentJobSchedulingRequestCompletionHandler(ChangeSummaryService<ChangeSummary> summaryService, ChangeSummaryGroupService<ChangeSummaryGroup> groupService, ChangeDeployService<ChangeDeploy> changeDeployService, DeploymentJobSchedulingRequestErrorHandler errorHandler) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Determines if this handler can handle the givenWorkflowRequestCompletion.protected voidfinishDeploymentScheduling(String deployId) Performs the final steps in scheduling aChangeDeploy: Locks the deployment then updates it status asChangeStatusType.FINISHEDand its state asChangeState.SCHEDULED.protected voidfinishGroupScheduling(String groupId) Performs the final steps in scheduling aChangeSummaryGroup: Locks the group then updates its status asChangeStatusType.FINISHEDand its state asChangeState.SCHEDULED.protected voidfinishScheduling(ChangeDeploy deployment, Collection<ChangeSummaryGroup> changeSummaryGroups) Performs the final steps in scheduling aChangeDeployand itsChangeSummaryGroupsby updating their states toChangeState.SCHEDULEDand their statuses toChangeStatusType.FINISHED.protected voidPerforms the final steps in scheduling aChangeSummary: Updates aChangeSummary'sstatus asChangeStatusType.FINISHEDand its state asChangeState.SCHEDULED.protected ChangeDeployService<ChangeDeploy>protected ChangeSummaryGroupService<ChangeSummaryGroup>protected ChangeSummaryService<ChangeSummary>voidhandle(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Gleans the ID of theChangeDeployfor which to complete the scheduling process and whether the microservice sending thecompletion messageencountered errors while performing the scheduling.
-
Constructor Details
-
DeploymentJobSchedulingRequestCompletionHandler
public DeploymentJobSchedulingRequestCompletionHandler(ChangeSummaryService<ChangeSummary> summaryService, ChangeSummaryGroupService<ChangeSummaryGroup> groupService, ChangeDeployService<ChangeDeploy> changeDeployService, DeploymentJobSchedulingRequestErrorHandler errorHandler)
-
-
Method Details
-
canHandle
public boolean canHandle(@NonNull com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Description copied from interface:WorkflowRequestCompletionHandlerDetermines if this handler can handle the givenWorkflowRequestCompletion. This is typically done by checking theWorkflowRequestCompletion.getRequestType().- Specified by:
canHandlein interfaceWorkflowRequestCompletionHandler- Parameters:
completion- aWorkflowRequestCompletionreceived over theWorkflowRequestCompletionConsumer channel- Returns:
- whether this handler can handle the given
WorkflowRequestCompletion
-
handle
public void handle(@NonNull com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Gleans the ID of theChangeDeployfor which to complete the scheduling process and whether the microservice sending thecompletion messageencountered errors while performing the scheduling.If errors were encountered, the statuses of the group and summary are udpated to
ChangeStatusType.ERROR_SCHEDULEand the error stack trace is recorded onto them.- Specified by:
handlein interfaceWorkflowRequestCompletionHandler- Parameters:
completion- aWorkflowRequestCompletionreceived over theWorkflowRequestCompletionConsumer channelcontaining information about the scheduledChangeDeployand one of itsChangeSummaryGroup'sChangeSummaries
-
finishScheduling
protected void finishScheduling(ChangeDeploy deployment, Collection<ChangeSummaryGroup> changeSummaryGroups) Performs the final steps in scheduling aChangeDeployand itsChangeSummaryGroupsby updating their states toChangeState.SCHEDULEDand their statuses toChangeStatusType.FINISHED.- Parameters:
deployment- The deployment to finish schedulingchangeSummaryGroups- TheChangeSummaryGroup instancesbelonging to the deployment.- Throws:
QualifiedStateException- Thrown if the deployment or a group fail to be updated
-
finishSummaryScheduling
Performs the final steps in scheduling aChangeSummary: Updates aChangeSummary'sstatus asChangeStatusType.FINISHEDand its state asChangeState.SCHEDULED.- Parameters:
groups- Stream ofChangeSummaryGroupsfrom which to derive the IDs ofChangeSummaries.
-
finishGroupScheduling
Performs the final steps in scheduling aChangeSummaryGroup: Locks the group then updates its status asChangeStatusType.FINISHEDand its state asChangeState.SCHEDULED.- Parameters:
groupId- The ID of the group to update- Throws:
QualifiedStateException- Thrown if the update fails.
-
finishDeploymentScheduling
Performs the final steps in scheduling aChangeDeploy: Locks the deployment then updates it status asChangeStatusType.FINISHEDand its state asChangeState.SCHEDULED.- Parameters:
deployId- The ID of the deployment to update- Throws:
QualifiedStateException- Thrown if the update fails.
-
getSummaryService
-
getGroupService
-
getChangeDeployService
-
getErrorHandler
-