public class ReschedulableFactory
extends java.lang.Object
Reschedulable
s.Constructor and Description |
---|
ReschedulableFactory() |
Modifier and Type | Method and Description |
---|---|
static <T> Reschedulable<T> |
buildForRepeatConsumer(RepeatConsumer<T> consumer,
java.util.List<java.time.Duration> repeatIntervals,
java.util.function.Consumer<T> exceededRedeliveryHandler)
Assembles a
Reschedulable that works with repeat messages. |
static <T> Reschedulable<T> |
buildOnceOffSchedule(RepeatConsumer<T> consumer,
java.util.function.Consumer<T> exceededRedeliveryHandler)
Assembles a
Reschedulable to deliver a channel message to the
specified RepeatConsumer exactly once. |
public static <T> Reschedulable<T> buildForRepeatConsumer(RepeatConsumer<T> consumer, java.util.List<java.time.Duration> repeatIntervals, java.util.function.Consumer<T> exceededRedeliveryHandler)
Reschedulable
that works with repeat messages.
This will be a MessageRepeater
if the given list of repeat
intervals is not empty; otherwise a OnceOffSchedule
with a
OnceOffRepeatConsumer
as a consumer.T
- the reschedulable type.consumer
- consumes the message output from the channel and returns
an indication of whether the same message should be delivered again.repeatIntervals
- intervals at which to re-deliver the message.exceededRedeliveryHandler
- is given the message after n
re-deliveries, where n
is the number of repeat intervals.Reschedulable
.java.lang.NullPointerException
- if any argument is null
.java.lang.IllegalArgumentException
- if the retry intervals list is not empty
but contains null
s.public static <T> Reschedulable<T> buildOnceOffSchedule(RepeatConsumer<T> consumer, java.util.function.Consumer<T> exceededRedeliveryHandler)
Reschedulable
to deliver a channel message to the
specified RepeatConsumer
exactly once. If the consumer asks to
deliver the message again, the message is given to the exceeded delivery
handler instead of being put back on the channel.T
- the reschedulable type.consumer
- consumes the message output from the channel and returns
an indication of whether the same message should be delivered again.exceededRedeliveryHandler
- is given the message if the consumer
asks to re-deliver.Reschedulable
.java.lang.NullPointerException
- if any argument is null
.