Class DeploymentWorkflowRequestCompletionHandler
java.lang.Object
com.broadleafcommerce.sandbox.messaging.completion.DeploymentWorkflowRequestCompletionHandler
- All Implemented Interfaces:
WorkflowRequestCompletionHandler
public class DeploymentWorkflowRequestCompletionHandler
extends Object
implements WorkflowRequestCompletionHandler
This handler deals with cleaning up deployed
ChangeDeploys' states and
statuses.- Author:
- Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorsConstructorDescriptionDeploymentWorkflowRequestCompletionHandler(ChangeSummaryService<ChangeSummary> summaryService, ChangeSummaryGroupService<ChangeSummaryGroup> groupService, ChangeDeployService<ChangeDeploy> changeDeployService, DeploymentWorkflowRequestErrorHandler errorHandler, IndexNotificationService indexNotificationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanareAllGroupsFinished(ChangeDeploy deployment) Deprecated, for removal: This API element is subject to removal in a future version.protected booleanDeprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultGroupDeployedCleanupServices.booleancanHandle(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Determines if this handler can handle the givenWorkflowRequestCompletion.protected voidfinishDeployingChanges(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion, String deployId) Performs the final steps in deploying aChangeDeployand itsChangeSummaryGroupsand theirChangeSummaries: Updates the state of theChangeSummaryindicated in the request asChangeState.DEPLOYEDand its status asChangeStatusType.FINISHEDIf this is the last summary in the group to finish, then theChangeSummaryGroupis updated likewise. And, if this is the last group in the deployment to finish, then theChangeDeployis updated likewise.protected voidfinishDeployment(String deployId) Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultDeployCleanupServices.protected voidfinishGroupDeployment(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultGroupDeployedCleanupServices.protected voidfinishSummaryDeployment(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Performs the final steps in deploying aChangeSummary: Updates its status asChangeStatusType.FINISHEDand its state asChangeState.DEPLOYED.protected ChangeDeployService<ChangeDeploy>protected DeploymentWorkflowRequestErrorHandlerprotected ChangeSummaryGroupService<ChangeSummaryGroup>protected IndexNotificationServiceprotected SandboxService<Sandbox>protected ChangeSummaryService<ChangeSummary>voidhandle(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Gleans the ID of theChangeDeployfor which to complete the deployment process and whether the microservice sending thecompletion messageencountered errors while performing the deployment.voidsetGroupRepository(ChangeSummaryGroupRepository<JpaChangeSummaryGroup> groupRepository) voidsetProperties(CompletionCleanupProperties properties) voidsetSandboxService(SandboxService<Sandbox> sandboxService) voidsetSummaryRepository(ChangeSummaryRepository<com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable> summaryRepository)
-
Constructor Details
-
DeploymentWorkflowRequestCompletionHandler
public DeploymentWorkflowRequestCompletionHandler(ChangeSummaryService<ChangeSummary> summaryService, ChangeSummaryGroupService<ChangeSummaryGroup> groupService, ChangeDeployService<ChangeDeploy> changeDeployService, DeploymentWorkflowRequestErrorHandler errorHandler, IndexNotificationService indexNotificationService)
-
-
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 deployment process and whether the microservice sending thecompletion messageencountered errors while performing the deployment.If errors were encountered, the statuses of the deployment, group, and summary are updated to
ChangeStatusType.ERROR_DEPLOYand the error stack trace is recorded onto them.- Specified by:
handlein interfaceWorkflowRequestCompletionHandler- Parameters:
completion- aWorkflowRequestCompletionreceived over theWorkflowRequestCompletionConsumer channelcontaining information about the deployedChangeDeploy, one of itsChangeSummaryGroups, and one of the group'sChangeSummariesfor which to complete the deployment process.
-
finishDeployingChanges
protected void finishDeployingChanges(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion, String deployId) Performs the final steps in deploying aChangeDeployand itsChangeSummaryGroupsand theirChangeSummaries:- Updates the state of the
ChangeSummaryindicated in the request asChangeState.DEPLOYED - and its status as
ChangeStatusType.FINISHED - If this is the last summary in the group to finish, then the
ChangeSummaryGroupis updated likewise. - And, if this is the last group in the deployment to finish, then the
ChangeDeployis updated likewise.
- Parameters:
completion- TheWorkflowRequestCompletionindicating the deployment, group, and summary for which to finish the deployment processdeployId- The ID of the deployment gleaned from the completion message- Throws:
IllegalStateException- Thrown if the summary's ID is missing from theWorkflowRequestCompletion.getTransferTypeIdMap().QualifiedStateException- Thrown if either the group or summary encounters errors while being updated.
- Updates the state of the
-
finishSummaryDeployment
protected void finishSummaryDeployment(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Performs the final steps in deploying aChangeSummary: Updates its status asChangeStatusType.FINISHEDand its state asChangeState.DEPLOYED.- Parameters:
completion- TheWorkflowRequestCompletioncontaining the information needed to identify a deployedChangeSummary.- Throws:
QualifiedStateException- Thrown if the update fails.IllegalStateException- Thrown if the summary's ID is missing from theWorkflowRequestCompletion.getTransferTypeIdMap().
-
finishGroupDeployment
@Deprecated(forRemoval=true, since="2.0.1") protected void finishGroupDeployment(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultGroupDeployedCleanupServices. SeeCompletionCleanupProperties.isEnabled().Performs the final steps in deploying aChangeSummaryGroupif all of its summaries have finished deploying: Locks and updates its status asChangeStatusType.FINISHEDand its state asChangeState.DEPLOYED.- Parameters:
completion- TheWorkflowRequestCompletioncontaining the information needed to identify a deployedChangeSummaryGroup.- Throws:
QualifiedStateException- Thrown if the update fails.IllegalStateException- Thrown if the group's ID is missing from theWorkflowRequestCompletion.getTransferTypeIdMap().
-
finishDeployment
Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultDeployCleanupServices. SeeCompletionCleanupProperties.isEnabled().Performs the final steps in deploying aChangeDeployif all of its change summary groups have finished deploying: Locks and updates its status asChangeStatusType.FINISHEDand its state asChangeState.DEPLOYED.- Parameters:
deployId- The ID of theChangeDeploy- Throws:
QualifiedStateException- Thrown if the update fails.IllegalStateException- Thrown if the deployment's ID is missing from theWorkflowRequestCompletion.getTransferTypeIdMap().
-
areAllSummariesFinished
@Deprecated(forRemoval=true, since="2.0.1") protected boolean areAllSummariesFinished(ChangeSummaryGroup group) Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultGroupDeployedCleanupServices. SeeCompletionCleanupProperties.isEnabled().Check if all of theChangeSummariesin theChangeSummaryGrouphave finished being deployed.This check is done to prevent the
ChangeSummaryGroupfrom being marked as DEPLOYED until all its summaries have been processed.- Parameters:
group- TheChangeSummaryGroupto potentially finish deploying- Returns:
- whether all of the group's summaries have finished being deployed.
-
areAllGroupsFinished
@Deprecated(forRemoval=true, since="2.0.1") protected boolean areAllGroupsFinished(ChangeDeploy deployment) Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultGroupDeployedCleanupServices. SeeCompletionCleanupProperties.isEnabled().Check if all of theChangeSummaryGroupsin theChangeDeployhave finished being deployed.This check is done to prevent the
ChangeDeployfrom being marked as DEPLOYED until all its groups have been processed.- Parameters:
deployment- TheChangeDeployto potentially finish deploying- Returns:
- whether all of the deployment's groups have finished being deployed.
-
getThroughputCache
-
getSummaryService
-
getGroupService
-
getChangeDeployService
-
getErrorHandler
-
getIndexNotificationService
-
getSandboxService
-
setSandboxService
-
getGroupRepository
-
setGroupRepository
@Autowired public void setGroupRepository(ChangeSummaryGroupRepository<JpaChangeSummaryGroup> groupRepository) -
setProperties
-
setSummaryRepository
@Autowired public void setSummaryRepository(ChangeSummaryRepository<com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable> summaryRepository)
-
DefaultGroupDeployedCleanupServices.