Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to use AbsoluteTimeAutoAdvancer or any type of scheduled activiation in a workflow?

Avatar

Level 4

Looking for some help implementing scheduled activation in a custom workflow. The only information i could really find was based on this post - http://forums.adobe.com/thread/988356 - which described AbsoluteTimeAutoAdvancer. I attempted to implement this by copying the participant step in the default "Scheduled Page/Asset Activation" workflow and setting the WorkflowData's MetaData property "absoluteTime" to my desired UNIX time. However, this doesn't seem to be functioning as it will just sit on the "waiting for activation" step. I've tried setting the time to before today, tomorrow, and not setting it at all. Am i missing something about how it works?

I also saw in that post that Justin suggested extending the AutoAdvance class and implementing the getTimeoutDate method. I attempted this as well (code below) but when it gets to this step it also doesn't advance. I can see the logging statement printed to the log so i know it is running. Am i missing another method that i should be implementing? (CQ5.6 using granite libraries)

@Service @Component(immediate=true, metatype=false) @Properties(value={ @Property(name="service.description",value="Publish Later Auto Advancer"), @Property(name="process.label",value="Publish Later Auto Advancer") }) public class PublishLaterTimeoutHandler extends AutoAdvancer implements AbsoluteTimeoutHandler { private static final Logger log = LoggerFactory.getLogger(PublishLaterTimeoutHandler.class); public long getTimeoutDate(WorkItem item) { log.info("TIMEOUT HANDLER RETURNING -1"); return -1; } }

And here is the step i'm using, a participant step assigned to admin.

[img]image001.png[/img]

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Correct answer by
Community Advisor

Hi,

   You can also write your own scheduler: Ref:  http://sling.apache.org/site/scheduler-service-commons-scheduler.html

Avatar

Level 4

Ok thanks. So the idea would be to create a scheduler that checks all active workflows for paused steps? Then, if those workflow's payloads are past their date, forward them to the next step? That sounds like it should work.

Avatar

Community Advisor

Yes, it's up to your requirement. If you want to schedule a step in the particular workflow, you can just add you custom scheduler for step itself as you were trying.