Package ru.yoomoney.tech.dbqueue.api
Class TaskExecutionResult
- java.lang.Object
-
- ru.yoomoney.tech.dbqueue.api.TaskExecutionResult
-
public final class TaskExecutionResult extends java.lang.ObjectThe action, which should be performed after the task processing.- Since:
- 09.07.2017
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTaskExecutionResult.TypeAction performed after task processing
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)static TaskExecutionResultfail()Instruction to execute the task again later according to there-enqueue strategyestablished in the queue configuration.static TaskExecutionResultfinish()Instruction to finish task processing and remove the task from the queueTaskExecutionResult.TypegetActionType()Get action, which should be performed after the task processing.java.util.Optional<java.time.Duration>getExecutionDelay()Get task execution delay.java.time.DurationgetExecutionDelayOrThrow()Get task execution delay or throw an IllegalStateException when task execution delay is not present.inthashCode()static TaskExecutionResultreenqueue()Instruction to re-enqueue the task using there-enqueue strategyestablished in the queue configuration.static TaskExecutionResultreenqueue(java.time.Duration delay)Instruction to re-enqueue the task with determined execution delay.java.lang.StringtoString()
-
-
-
Method Detail
-
getActionType
@Nonnull public TaskExecutionResult.Type getActionType()
Get action, which should be performed after the task processing.- Returns:
- action, which should be performed after the task processing.
-
getExecutionDelay
@Nonnull public java.util.Optional<java.time.Duration> getExecutionDelay()
Get task execution delay.- Returns:
- task execution delay.
-
getExecutionDelayOrThrow
@Nonnull public java.time.Duration getExecutionDelayOrThrow()
Get task execution delay or throw an IllegalStateException when task execution delay is not present.- Returns:
- task execution delay.
- Throws:
java.lang.IllegalStateException- An exception when task execution delay is not present.
-
reenqueue
@Nonnull public static TaskExecutionResult reenqueue(@Nonnull java.time.Duration delay)
Instruction to re-enqueue the task with determined execution delay.
Re-enqueue attempts counter will be reset, task will be executed again after the given execution delay.- Parameters:
delay- determined execution delay, after which the task will be executed again.- Returns:
- Task execution action.
-
reenqueue
@Nonnull public static TaskExecutionResult reenqueue()
Instruction to re-enqueue the task using there-enqueue strategyestablished in the queue configuration. Re-enqueue attempts counter will be reset.- Returns:
- Task execution action.
-
fail
@Nonnull public static TaskExecutionResult fail()
Instruction to execute the task again later according to there-enqueue strategyestablished in the queue configuration.- Returns:
- Task execution action.
-
finish
@Nonnull public static TaskExecutionResult finish()
Instruction to finish task processing and remove the task from the queue- Returns:
- Task execution action.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-