Skip to content

Orchestrator function doesn't wait for external event if timer is more than 3days #136

@kanupriya15025

Description

@kanupriya15025

I am trying to send an event to my eternal orchestrator function while my function is sleeping with a timer. If the timer is more than 3days, the orchestrator function doesn't read the message and ignores it. Here's my code :

            Task<JsonNode> patchEvent = ctx.waitForExternalEvent("patchEvent", JsonNode.class);
            Task<?> sleepTask = ctx.createTimer(timeToStartDate);
            Task<?> winnerEvent = ctx.anyOf(patchEvent, sleepTask).await();
            if (winnerEvent == patchEvent) {
                jsonBody = patchEvent.await();
                if (!ctx.getIsReplaying()) {
                    LOGGER.info("Patch received before start of schedule. JSON {}", jsonBody);
                    ctx.continueAsNew(jsonBody);
                    return;
                }
            } else {
                LOGGER.info("Timer elapsed. No patch event received");
            }
        }

If the duration of the sleep task is less than 3days, it reads the patchEvent and executes the first "if" block. However, if the timer is more than 3days, the event is read and then discarded.

Here are the logs:

  1. Timer less than 3days :

[2023-05-23T08:51:09.400Z] 14:21:09.399 [pool-2-thread-8] INFO  com.adobe.orchestration.EternalOrchestrator - kanu_java_test_1: startDate is: 2023-05-26T00:00:00.000-05:00
[2023-05-23T08:51:09.400Z] 14:21:09.399 [pool-2-thread-8] INFO  com.adobe.orchestration.EternalOrchestrator - kanu_java_test_1: Workflow startDate is in future, Starting a timer for duration: PT68H9M2S seconds
[2023-05-23T08:51:09.400Z] 14:21:09.399 [pool-2-thread-8] INFO  com.adobe.orchestration.EternalOrchestrator - Patch received before start of schedule. JSON {JSON Body}

  1. Timer greater than 3days :

[2023-05-23T08:51:18.054Z] Executing 'Functions.EternalOrchestrator' (Reason='(null)', Id=a429e287-8e6b-43a5-8b4e-53189c221bd6)
[2023-05-23T08:51:18.060Z] 14:21:18.060 [pool-2-thread-8] INFO  com.adobe.orchestration.EternalOrchestrator - kanu_java_test_1: startDate is: 2023-05-27T00:00:00.000-05:00
[2023-05-23T08:51:18.061Z] 14:21:18.060 [pool-2-thread-8] INFO  com.adobe.orchestration.EternalOrchestrator - kanu_java_test_1: Workflow startDate is in future, Starting a timer for duration: PT92H8M50S seconds
[2023-05-23T08:51:18.061Z] Function "EternalOrchestrator" (Id: a429e287-8e6b-43a5-8b4e-53189c221bd6) invoked by Java Worker
[2023-05-23T08:51:18.064Z] Executed 'Functions.EternalOrchestrator' (Succeeded, Id=a429e287-8e6b-43a5-8b4e-53189c221bd6, Duration=12ms)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneed investigationNeed investigation from a maintainer

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions