Workflow.sleep(theMilliSeconds);

Workflow.sleep(theMilliSeconds);

does not work inside my workflow. What am I missing?

@Override
    public void executeActivities(MyDomain object) throws NonRetriableTaskException {
        final long theDelay = theActivity.getDelayTime(object);
        if (theDelay > 0) {
            log.info("about to sleep...");
            Workflow.sleep(theDelay);
            log.info("slept");
        }
        theActivity.process(object);
    }

Hi,

What error are you getting?

I am not getting any error, the code just executes as if Workflow.sleep() statement did nothing

But I found the issue, removed @ActivityMethod from getDelayTime method and it works as expected. Not sure if this is expected behaviour of sleep.

I would try returning this annotation and looking at the workflow history to see the activity result. I guess that the 0 was returned.