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 TypeMethodDescriptionboolean
canHandle
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Determines if this handler can handle the givenWorkflowRequestCompletion
.protected void
finishDeploymentScheduling
(String deployId) Performs the final steps in scheduling aChangeDeploy
: Locks the deployment then updates it status asChangeStatusType.FINISHED
and its state asChangeState.SCHEDULED
.protected void
finishGroupScheduling
(String groupId) Performs the final steps in scheduling aChangeSummaryGroup
: Locks the group then updates its status asChangeStatusType.FINISHED
and its state asChangeState.SCHEDULED
.protected void
finishScheduling
(ChangeDeploy deployment, Collection<ChangeSummaryGroup> changeSummaryGroups) Performs the final steps in scheduling aChangeDeploy
and itsChangeSummaryGroups
by updating their states toChangeState.SCHEDULED
and their statuses toChangeStatusType.FINISHED
.protected void
Performs the final steps in scheduling aChangeSummary
: Updates aChangeSummary's
status asChangeStatusType.FINISHED
and its state asChangeState.SCHEDULED
.protected ChangeDeployService<ChangeDeploy>
protected ChangeSummaryGroupService<ChangeSummaryGroup>
protected ChangeSummaryService<ChangeSummary>
void
handle
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Gleans the ID of theChangeDeploy
for which to complete the scheduling process and whether the microservice sending thecompletion message
encountered 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:WorkflowRequestCompletionHandler
Determines if this handler can handle the givenWorkflowRequestCompletion
. This is typically done by checking theWorkflowRequestCompletion.getRequestType()
.- Specified by:
canHandle
in interfaceWorkflowRequestCompletionHandler
- Parameters:
completion
- aWorkflowRequestCompletion
received 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 theChangeDeploy
for which to complete the scheduling process and whether the microservice sending thecompletion message
encountered errors while performing the scheduling.If errors were encountered, the statuses of the group and summary are udpated to
ChangeStatusType.ERROR_SCHEDULE
and the error stack trace is recorded onto them.- Specified by:
handle
in interfaceWorkflowRequestCompletionHandler
- Parameters:
completion
- aWorkflowRequestCompletion
received over theWorkflowRequestCompletionConsumer channel
containing information about the scheduledChangeDeploy
and one of itsChangeSummaryGroup's
ChangeSummaries
-
finishScheduling
protected void finishScheduling(ChangeDeploy deployment, Collection<ChangeSummaryGroup> changeSummaryGroups) Performs the final steps in scheduling aChangeDeploy
and itsChangeSummaryGroups
by updating their states toChangeState.SCHEDULED
and their statuses toChangeStatusType.FINISHED
.- Parameters:
deployment
- The deployment to finish schedulingchangeSummaryGroups
- TheChangeSummaryGroup instances
belonging 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's
status asChangeStatusType.FINISHED
and its state asChangeState.SCHEDULED
.- Parameters:
groups
- Stream ofChangeSummaryGroups
from which to derive the IDs ofChangeSummaries
.
-
finishGroupScheduling
Performs the final steps in scheduling aChangeSummaryGroup
: Locks the group then updates its status asChangeStatusType.FINISHED
and 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.FINISHED
and its state asChangeState.SCHEDULED
.- Parameters:
deployId
- The ID of the deployment to update- Throws:
QualifiedStateException
- Thrown if the update fails.
-
getSummaryService
-
getGroupService
-
getChangeDeployService
-
getErrorHandler
-