Class Schedule
java.lang.Object
io.fluxzero.sdk.common.Message
io.fluxzero.sdk.scheduling.Schedule
- All Implemented Interfaces:
HasMessage
Represents a scheduled message to be delivered at a specific future time.
Schedule extends Message with a scheduleId and a deadline indicating when
the message should be delivered.
It supports transformation and enrichment just like a regular Message, and includes convenience
methods for rescheduling.
Typical Usage
new Schedule(new Reminder("water the plants"), Duration.ofHours(1));
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic StringMetadata key for the schedule identifier.Fields inherited from interface HasMessage
warnedAboutMissingProperty -
Constructor Summary
ConstructorsConstructorDescriptionSchedule(Object payload, io.fluxzero.common.api.Metadata metadata, String scheduleId, Instant deadline) Full constructor specifying payload, metadata, scheduleId, and deadline.Schedule(Object payload, io.fluxzero.common.api.Metadata metadata, String messageId, Instant timestamp, String scheduleId, Instant deadline) Full constructor including message ID and timestamp.Creates a new scheduled message with a givenscheduleId.Creates a new schedule using the current identity provider for thescheduleIdand a future deadline. -
Method Summary
Modifier and TypeMethodDescriptionaddMetadata(io.fluxzero.common.api.Metadata metadata) Returns a new schedule with additional metadata.addMetadata(Object... keyValues) Returns a new schedule with multiple metadata entries added.addMetadata(String key, Object value) Returns a new schedule with a single metadata entry added.addMetadata(Map<String, ?> values) Returns a new schedule with all values from the given metadata map added.Returns a new schedule with aUseradded to the metadata using the configuredUserProvider.default booleanchunked()default boolean@NonNull InstantThe time at which this scheduled message should be delivered.io.fluxzero.common.api.Metadata@NonNull StringUnique identifier for this scheduled message.default booleanreschedule(Duration duration) Returns a newSchedulewith the samescheduleIdand a new deadline offset by the given duration.withMessageId(String messageId) Returns a new instance with the given message ID.withMetadata(io.fluxzero.common.api.Metadata metadata) Returns a new instance with the given metadata.withPayload(Object payload) Returns a new instance with the given payload.withTimestamp(Instant timestamp) Returns a new instance with the given timestamp.Methods inherited from class Message
asMessage, getPayload, serialize, toMessageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HasMessage
computeRoutingKey, getMessageId, getPayloadAs, getPayloadClass, getRoutingKey, getRoutingKey, getTimestamp
-
Field Details
-
scheduleIdMetadataKey
Metadata key for the schedule identifier. -
FIRST_CHUNK
- See Also:
-
FINAL_CHUNK
- See Also:
-
CHUNK_INDEX
- See Also:
-
-
Constructor Details
-
Schedule
-
Schedule
-
Schedule
-
Schedule
-
-
Method Details
-
withPayload
Returns a new instance with the given payload.- Overrides:
withPayloadin classMessage
-
withMetadata
Returns a new instance with the given metadata. -
withMessageId
-
withTimestamp
-
addMetadata
Returns a new schedule with additional metadata.- Overrides:
addMetadatain classMessage
-
addMetadata
Returns a new schedule with a single metadata entry added.- Overrides:
addMetadatain classMessage
-
addMetadata
Returns a new schedule with multiple metadata entries added.- Overrides:
addMetadatain classMessage
-
addMetadata
Returns a new schedule with all values from the given metadata map added.- Overrides:
addMetadatain classMessage
-
addUser
-
reschedule
-
getScheduleId
Unique identifier for this scheduled message. Used to replace, cancel, or retrieve the schedule. -
getDeadline
The time at which this scheduled message should be delivered. -
getMetadata
io.fluxzero.common.api.Metadata getMetadata() -
chunked
default boolean chunked() -
lastChunk
default boolean lastChunk() -
firstChunk
default boolean firstChunk()
-