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 boolean
areAllGroupsFinished
(ChangeDeploy deployment) Deprecated, for removal: This API element is subject to removal in a future version.protected boolean
Deprecated, for removal: This API element is subject to removal in a future version.A new, more performant cleanup process is favored instead atDefaultGroupDeployedCleanupServices
.boolean
canHandle
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Determines if this handler can handle the givenWorkflowRequestCompletion
.protected void
finishDeployingChanges
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion, String deployId) Performs the final steps in deploying aChangeDeploy
and itsChangeSummaryGroups
and theirChangeSummaries
: Updates the state of theChangeSummary
indicated in the request asChangeState.DEPLOYED
and its status asChangeStatusType.FINISHED
If this is the last summary in the group to finish, then theChangeSummaryGroup
is updated likewise. And, if this is the last group in the deployment to finish, then theChangeDeploy
is updated likewise.protected void
finishDeployment
(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 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
.protected void
finishSummaryDeployment
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Performs the final steps in deploying aChangeSummary
: Updates its status asChangeStatusType.FINISHED
and its state asChangeState.DEPLOYED
.protected ChangeDeployService<ChangeDeploy>
protected DeploymentWorkflowRequestErrorHandler
protected ChangeSummaryGroupService<ChangeSummaryGroup>
protected IndexNotificationService
protected SandboxService<Sandbox>
protected ChangeSummaryService<ChangeSummary>
void
handle
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Gleans the ID of theChangeDeploy
for which to complete the deployment process and whether the microservice sending thecompletion message
encountered errors while performing the deployment.void
setGroupRepository
(ChangeSummaryGroupRepository<JpaChangeSummaryGroup> groupRepository) void
setProperties
(CompletionCleanupProperties properties) void
setSandboxService
(SandboxService<Sandbox> sandboxService) void
setSummaryRepository
(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: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 deployment process and whether the microservice sending thecompletion message
encountered errors while performing the deployment.If errors were encountered, the statuses of the deployment, group, and summary are updated to
ChangeStatusType.ERROR_DEPLOY
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 deployedChangeDeploy
, one of itsChangeSummaryGroups
, and one of the group'sChangeSummaries
for 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 aChangeDeploy
and itsChangeSummaryGroups
and theirChangeSummaries
:- Updates the state of the
ChangeSummary
indicated in the request asChangeState.DEPLOYED
- and its status as
ChangeStatusType.FINISHED
- If this is the last summary in the group to finish, then the
ChangeSummaryGroup
is updated likewise. - And, if this is the last group in the deployment to finish, then the
ChangeDeploy
is updated likewise.
- Parameters:
completion
- TheWorkflowRequestCompletion
indicating 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.FINISHED
and its state asChangeState.DEPLOYED
.- Parameters:
completion
- TheWorkflowRequestCompletion
containing 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 aChangeSummaryGroup
if all of its summaries have finished deploying: Locks and updates its status asChangeStatusType.FINISHED
and its state asChangeState.DEPLOYED
.- Parameters:
completion
- TheWorkflowRequestCompletion
containing 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 aChangeDeploy
if all of its change summary groups have finished deploying: Locks and updates its status asChangeStatusType.FINISHED
and 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 theChangeSummaries
in theChangeSummaryGroup
have finished being deployed.This check is done to prevent the
ChangeSummaryGroup
from being marked as DEPLOYED until all its summaries have been processed.- Parameters:
group
- TheChangeSummaryGroup
to 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 theChangeSummaryGroups
in theChangeDeploy
have finished being deployed.This check is done to prevent the
ChangeDeploy
from being marked as DEPLOYED until all its groups have been processed.- Parameters:
deployment
- TheChangeDeploy
to 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
.