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
Applaud 25
Level 10
asutosh_jena
Level 10

Likes

577 likes

Total Posts

687 posts

Correct Reply

199 solutions
Top badges earned
Applaud 25
Give Back 100
Boost 500
Affirm 100
Ignite 1
View profile

Avatar
Applaud 25
Level 10
asutosh_jena
Level 10

Likes

577 likes

Total Posts

687 posts

Correct Reply

199 solutions
Top badges earned
Applaud 25
Give Back 100
Boost 500
Affirm 100
Ignite 1
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!