Custom retry configuration in Camunda Wildlfy subsystem

Hi,

I am trying to enable custom retry configuration for failed jobs in Wildfly 8 server with a shared process engine.
I am copying my process engine configuration below.

 <process-engines>
                    <process-engine name="default" default="true">
                        <datasource>
                            java:jboss/datasources/ProcessEngineDS
                        </datasource>
                        <history-level>
                            full
                        </history-level>
                        <configuration>
                            org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration
                        </configuration>
                        <properties>
                            <property name="jobExecutorAcquisitionName">
                                default
                            </property>
                            <property name="isAutoSchemaUpdate">
                                true
                            </property>
                            <property name="authorizationEnabled">
                                true
                            </property>
                            <property name="jobExecutorDeploymentAware">
                                false
                            </property>
					<property name="customPostBPMNParseListeners">
						  org.camunda.bpm.engine.impl.bpmn.parser.FoxFailedJobParseListener
					</property>
					<property name="failedJobCommandFactory">
						  org.camunda.bpm.engine.impl.jobexecutor.FoxFailedJobCommandFactory
					</property>
                        </properties>
                    </process-engine>
                </process-engines>
                <job-executor>
                    <thread-pool-name>
                        job-executor-tp
                    </thread-pool-name>
                    <job-acquisitions>
                        <job-acquisition name="default">
                            <acquisition-strategy>
                                SEQUENTIAL
                            </acquisition-strategy>
                            <properties>
                                <property name="lockTimeInMillis">
                                    300000
                                </property>
                                <property name="waitTimeInMillis">
                                    5000
                                </property>
                                <property name="maxJobsPerAcquisition">
                                    3
                                </property>
                            </properties>
                        </job-acquisition>
                    </job-acquisitions>
                </job-executor>

But I am facing exception while setting the process engine properties on Wildfly server startup.

2017-11-20 21:18:30,849 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 58) MSC000001: Failed to start service org.camunda.bpm.platform.process-engine.default: org.jboss.msc.service.StartException in service org.camunda.bpm.platform.process-engine.default: org.camunda.bpm.engine.ProcessEngineException: Could not set value for property 'customPostBPMNParseListeners' on class org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration
	at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:97)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_80]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_80]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]
Caused by: org.camunda.bpm.engine.ProcessEngineException: Could not set value for property 'customPostBPMNParseListeners' on class org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration
	at org.camunda.bpm.container.impl.metadata.PropertyHelper.applyProperty(PropertyHelper.java:76)
	at org.camunda.bpm.container.impl.metadata.PropertyHelper.applyProperties(PropertyHelper.java:94)
	at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startProcessEngine(MscManagedProcessEngineController.java:173)
	at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:131)
	at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:129)
	at org.camunda.bpm.container.impl.jboss.util.Tccl.runWithTccl(Tccl.java:53)
	at org.camunda.bpm.container.impl.jboss.util.Tccl.runUnderClassloader(Tccl.java:45)
	at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startInternal(MscManagedProcessEngineController.java:129)
	at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:90)
	... 6 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_80]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_80]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_80]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_80]
	at org.camunda.bpm.container.impl.metadata.PropertyHelper.applyProperty(PropertyHelper.java:74)
	... 14 more

Please help me configure the custom retry behavior in Wildfly.

Syed

1 Like

Hello Syed,

What Camunda version do you use?

Best regards,
Yana

If you are using 7.7 version or older you need to adjust the following

you can check for more information here.

You do not need to enable the custom retry configuration when you are using
the Wildfly/JBoss subsystem. It is enabled by default when you use the
configuration class ‘org.camunda.bpm.container.impl.jboss.config.
ManagedJtaProcessEngineConfiguration’.

1 Like

Hi @yana.vasileva

I am using Camunda 7.3.0 version

I have added the properties as given below in the process engine configuration and upon restarting the server, I face the exception in the first post.

                                      <property name="customPostBPMNParseListeners">
					  org.camunda.bpm.engine.impl.bpmn.parser.FoxFailedJobParseListener
				</property>
				<property name="failedJobCommandFactory">
					  org.camunda.bpm.engine.impl.jobexecutor.FoxFailedJobCommandFactory
				</property>

@hawky4s

I have tried without the retry configuration and configured a retry cycle of R3/PT5M for an asynchronous service task. But the configuration is not reflected and upon failure, the job retried aggressively for 3 times without any delay. That is why I am trying to check with the configuration in place.

Hi @syed,

Can you please post the part of the BPMN where you did the configuration of the retry?
The implicit configuration of the feature inside the subsystem is also present in 7.3. See https://github.com/camunda/camunda-bpm-platform/blob/7.3.0/distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/config/ManagedJtaProcessEngineConfiguration.java

Cheers,
Christian

@hawky4s Sorry for my late reply.

I have removed the below properties from process engine configuration

<property name=“customPostBPMNParseListeners”>
org.camunda.bpm.engine.impl.bpmn.parser.FoxFailedJobParseListener
</property>
<property name=“failedJobCommandFactory”>
org.camunda.bpm.engine.impl.jobexecutor.FoxFailedJobCommandFactory
</property>

and configured retry cycle for the timer intermediate catch event as below,

<bpmn2:intermediateCatchEvent id="startTimer" camunda:asyncAfter="true" name="Start the timer">
      <bpmn2:extensionElements>
        <camunda:executionListener event="end" expression="${logic.handleCancellation(execution)}"/>
        <fox:failedJobRetryTimeCycle>R5/PT1M</fox:failedJobRetryTimeCycle>
      </bpmn2:extensionElements>
      <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
      <bpmn2:timerEventDefinition id="TimerEventDefinition_1">
        <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${duration}</bpmn2:timeDuration>
      </bpmn2:timerEventDefinition>
    </bpmn2:intermediateCatchEvent>

Tested exception case by providing a invalid CDI expression for the service task following the timer event. The retry was successful with a delay of 1 minute between 5 repetitions.

Earlier, the custom retry didn’t work for me because the custom retry was configured for the service task following the timer with asyncBefore set as true and exception to check the retry behaviour was introduced in the service task using an invalid CDI expression. Now I have configured the custom retry for the timer with asyncAfter set as true for timer and the custom retry is working fine.

@hawky4s Thanks again for taking your time to provide clarity on the underlying code.