Interface BridgeHttpTime

All Known Subinterfaces:
BridgeHttp
All Known Implementing Classes:
BridgeHttpImpl, DummyBridgeHttp

public interface BridgeHttpTime
BridgeHttpTime to handle request to a endpoint based on a time delay.

The calculation when an endpoint gets called is provided in the DelayTimeProvider. The DelayTimeProvider.nextRun(boolean, boolean) gets called instantly when the initial method to add the endpoint gets called and then every time after the last endpoint handle was finished.

So for e. g. if a fixed delay of 1 minute gets provided the time will shift into the back a little bit every time an endpoint gets called because fetching the endpoint and handling it also takes some time.

A simple example to subscribe to an endpoint with 1 minute delay in between would be:

 final var delayProvider = DelayTimeProviderChain.fixedDelay(Duration.ofMinutes(1));
 this.httpBridge.subscribeTime(delayProvider, "http://127.0.0.1/status", t -> {
        // process data
 }, t -> {
        // handle error
 });