Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Stop retrying Workflow using java

Avatar

Avatar
Validate 1
Level 1
infinityskyline
Level 1

Like

1 like

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
infinityskyline
Level 1

Like

1 like

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
infinityskyline
Level 1

16-04-2021

Hi,

I have a custom workflow which I don't want to be retried if fails.

if (schemaErrors.size() > 0) {

                // session.terminateWorkflow(item.getWorkflow());

                String message = LOG.log(Messages.EXCEPTION_RUNNING_UPGRADE_WORKFLOW);

                throw new WorkflowException(message);

}

Is there a way to stop retrying once I throw a workflow exception? I have tried with terminateWorkflow but it doesn't seem to work.

AEM java workflow
View Entire Topic

Avatar

Avatar
Affirm 100
Level 10
asutosh_jena
Level 10

Likes

415 likes

Total Posts

528 posts

Correct Reply

140 solutions
Top badges earned
Affirm 100
Ignite 1
Establish
Give Back 50
Give Back 5
View profile

Avatar
Affirm 100
Level 10
asutosh_jena
Level 10

Likes

415 likes

Total Posts

528 posts

Correct Reply

140 solutions
Top badges earned
Affirm 100
Ignite 1
Establish
Give Back 50
Give Back 5
View profile
asutosh_jena
Level 10

16-04-2021

Hi @infinityskyline 

 

Within the execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) you can write the below step which will terminate the workflow.

 

Workflow workflow = workflowSession.getWorkflow(workItem.getWorkflow().getId());
workflowSession.terminateWorkflow(workflow);

 

Thanks!