Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Different timeout for a step in workflow for different workflow instances

Avatar

Level 3

Hi,

I want to set a different timeout for a participant step in a workflow for different instances of the workflow running on different payloads. For e.g. I want to set a timeout of 2 hours for 1 instance of a workflow running on payload A. And for another instance of the same workflow on a different payload, Payload B, I want to set the timeout as 3 hours.Please tell if anybody has any pointers on this.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hmmm...  Sorry I misunderstood run mode with workflow instance.

You can write a new class which extends from AutoAdvance and implements the AbsoluteTimeoutHandler interface[1] & in getTimeoutDate have method like [2] & can avoid OR split.

[1]   http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/workflow/job/AbsoluteTimeoutHandler.html

[2]

if (isPayLoadA()) {

  return 10 min;

} else if (isPayLoadB()) {

  return 15 min;

}

else {

  return -1; // timeout now

}

View solution in original post

5 Replies

Avatar

Level 10

Utilize runmode config here.

Avatar

Level 3

runmode config will not help here. It's changing the configuration parameters for a CQ instance. I am talking here about a workflow instance.

Avatar

Level 10

Why not?  Unless i misunderstood your requirement.  Implement the osgi bundle with the AbsoluteTimeoutHandler & in the bundle you can get run mode parameter. 

Avatar

Former Community Member

Hi Sham,

If I am not wrong his requirement is adding 2 participant steps (they will be in or split) in the same work flow which has 2 different timeouts. Based on the payload some times it has to take right step and some times it will go through left step. I tried this but by default it is taking latest instance timeout setting and it is not completing previous instances.

Below are the logs in time out. My understanding is, it is taking only latest timout settings per workflow.

In a nutshell can we have more than one step with different timeouts?

12.12.2013 17:57:40.376 *INFO* [pool-6-thread-2] org.apache.sling.event.impl.jobs.queues.TopicRoundRobinJobQueue.Granite Workflow Timeout Queue Stopped job queue Granite Workflow Timeout Queue
12.12.2013 17:57:40.377 *INFO* [pool-6-thread-2] org.apache.sling.event Service [QueueMBean for queue Granite Workflow Timeout Queue,1974] ServiceEvent UNREGISTERING
12.12.2013 17:57:40.378 *INFO* [pool-6-thread-2] org.apache.sling.event.impl.jobs.queues.TopicRoundRobinJobQueue.Granite Workflow Queue Stopped job queue Granite Workflow Queue
12.12.2013 17:57:40.379 *INFO* [pool-6-thread-2] org.apache.sling.event Service [QueueMBean for queue Granite Workflow Queue,1975] ServiceEvent UNREGISTERING
12.12.2013 17:58:15.128 *INFO* [pool-6-thread-4] org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager cachename=versionBundleCache[ConcurrentCache@76a33ed9], elements=5117, usedmemorykb=4821, maxmemorykb=8192, access=94234, miss=5117
12.12.2013 17:58:15.151 *INFO* [Apache Sling Job Background Loader] org.apache.sling.event Service [QueueMBean for queue Granite Workflow Timeout Queue,1976] ServiceEvent REGISTERED
12.12.2013 17:58:15.154 *INFO* [Apache Sling Job Queue Granite Workflow Timeout Queue] org.apache.sling.event.impl.jobs.queues.TopicRoundRobinJobQueue.Granite Workflow Timeout Queue Starting job queue Granite Workflow Timeout Queue
12.12.2013 17:58:15.215 *INFO* [pool-7-thread-22] org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager cachename=crx.defaultBundleCache[ConcurrentCache@3f73b038], elements=3252, usedmemorykb=8183, maxmemorykb=8192, access=414274, miss=115972

Avatar

Correct answer by
Level 10

Hmmm...  Sorry I misunderstood run mode with workflow instance.

You can write a new class which extends from AutoAdvance and implements the AbsoluteTimeoutHandler interface[1] & in getTimeoutDate have method like [2] & can avoid OR split.

[1]   http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/workflow/job/AbsoluteTimeoutHandler.html

[2]

if (isPayLoadA()) {

  return 10 min;

} else if (isPayLoadB()) {

  return 15 min;

}

else {

  return -1; // timeout now

}