Search code examples
cadence-workflowuber-cadence

Cadence Java client, unable to get history of workflow executions


I am following the idea, mentioned in this answer and trying this:

workflowTChannel.ListClosedWorkflowExecutions(ListClosedWorkflowExecutionsRequest().apply {
    domain = "valid-domain-name"

    startTimeFilter = StartTimeFilter().apply {
        setEarliestTime(Instant.parse("2023-01-01T00:00:00.000Z").toEpochMilli())
        setLatestTime(Instant.parse("2024-01-01T00:59:59.999Z").toEpochMilli())
    }
})

However, the result is always an empty list. Fetching the list via UI works fine at the same time. Using PostgreSQL and local test installation without advanced visibility.

UPD: debugged Cadence locally and found that it expects nanoseconds instead of milliseconds. This way correct parameters must be prepared like this:

Instant.parse("2023-01-01T00:00:00.000Z").toEpochMilli() * 1000000

Solution

  • My guess is that you are using seconds and Cadence expects nanoseconds timestamps.