Method not found

Here, following code is provided:

public ServerServiceCall<String, Source<String, ?>> tick(int intervalMs) {
return tickMessage -> {
Duration interval = Duration.ofMillis(intervalMs);
return completedFuture(Source.tick(interval, interval, tickMessage));

But compilation errors occur. Both ofMillis() and Source.tick() methods are not found.
Is code not in sync with latest API?

Issue is solved.
Duration is java.time.Duration. It seems I was wrongly making use of some other Duration class.