Class DefaultMessageScheduler
java.lang.Object
io.fluxzero.sdk.common.AbstractNamespaced<MessageScheduler>
io.fluxzero.sdk.scheduling.DefaultMessageScheduler
- All Implemented Interfaces:
Namespaced<MessageScheduler>, MessageScheduler, HasLocalHandlers
public class DefaultMessageScheduler
extends AbstractNamespaced<MessageScheduler>
implements MessageScheduler, HasLocalHandlers
Default implementation of the
MessageScheduler interface.
This implementation uses a SchedulingClient to schedule and cancel scheduled messages,
and implements the HasLocalHandlers interface to allow for local handling of scheduled messages,
used by TestFixtures.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelSchedule(@NonNull Object scheduleId) Cancel a previously scheduled message or command by ID.protected MessageSchedulercreateForNamespace(String namespace) getSchedule(@NonNull Object scheduleId) Look up an existing schedule.voidhandleLocally(Schedule schedule) Schedule the givenScheduleobject, optionally skipping if already present, using the specified guarantee.scheduleCommand(Schedule schedule, boolean ifAbsent, Guarantee guarantee) Schedule a command using the given scheduling settings, using the providedGuarantee.Methods inherited from class AbstractNamespaced
close, forNamespaceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HasLocalHandlers
hasLocalHandlers, registerHandler, registerHandler, setSelfHandlerFilterMethods inherited from interface MessageScheduler
schedule, schedule, schedule, schedule, schedule, schedule, schedule, schedule, scheduleCommand, scheduleCommand, scheduleCommand, scheduleCommand, scheduleCommand, scheduleCommand, scheduleCommand, scheduleCommand, schedulePeriodic, schedulePeriodicMethods inherited from interface Namespaced
forDefaultNamespace, forNamespace
-
Constructor Details
-
DefaultMessageScheduler
public DefaultMessageScheduler()
-
-
Method Details
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<MessageScheduler>
-
schedule
Description copied from interface:MessageSchedulerSchedule the givenScheduleobject, optionally skipping if already present, using the specified guarantee.- Specified by:
schedulein interfaceMessageScheduler- Parameters:
message- the schedule messageifAbsent- only schedule if not already scheduledguarantee- the delivery guarantee to use- Returns:
- a CompletableFuture completing when the message is successfully scheduled
-
scheduleCommand
public CompletableFuture<Void> scheduleCommand(Schedule schedule, boolean ifAbsent, Guarantee guarantee) Description copied from interface:MessageSchedulerSchedule a command using the given scheduling settings, using the providedGuarantee.- Specified by:
scheduleCommandin interfaceMessageScheduler- Parameters:
schedule- the command scheduleifAbsent- skip if existing schedule is presentguarantee- the delivery guarantee to apply- Returns:
- a future indicating when the command is scheduled
-
cancelSchedule
Description copied from interface:MessageSchedulerCancel a previously scheduled message or command by ID.- Specified by:
cancelSchedulein interfaceMessageScheduler- Parameters:
scheduleId- the ID of the schedule to cancel
-
getSchedule
Description copied from interface:MessageSchedulerLook up an existing schedule.- Specified by:
getSchedulein interfaceMessageScheduler- Parameters:
scheduleId- the ID of the schedule- Returns:
- the schedule if found
-
handleLocally
-