Interface TimeProviderMiddleware
-
- All Superinterfaces:
Middleware
- All Known Subinterfaces:
LockMiddleware
,PermissionMiddleware
,RateLimiterMiddleware
- All Known Implementing Classes:
RedisLockMiddleware
public interface TimeProviderMiddleware extends Middleware
A middleware extension that allows implementation to provide different types of delay in different case.- See Also:
TaskExecutionBackOff
-
-
Field Summary
Fields Modifier and Type Field Description static java.time.Duration
ONE_SECOND
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.time.Duration
releaseIn(Job job)
A middleware can dispose the current job or put it back to queue.-
Methods inherited from interface com.github.sonus21.rqueue.core.middleware.Middleware
handle
-
-
-
-
Method Detail
-
releaseIn
default java.time.Duration releaseIn(Job job)
A middleware can dispose the current job or put it back to queue. While putting back, a middleware can decide to put this job in queue immediately or in 5 seconds or so. Releasing job immediately has side effect when job queue is empty. Job can reappear to the queue as soon as it is put back in the queue, so the delay should be large enough to handle parallel execution otherwise it can create loop. By default job is released to queue in one second.Another implementation can use
TaskExecutionBackOff
to provide this delay- Parameters:
job
- the current job- Returns:
- time duration
-
-