Class Schedule
java.lang.Object
io.fluxzero.sdk.common.Message
io.fluxzero.sdk.scheduling.Schedule
- All Implemented Interfaces:
HasMetadata, 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
FieldsFields inherited from interface HasMessage
warnedAboutMissingPropertyFields inherited from interface HasMetadata
FINAL_CHUNK -
Constructor Summary
ConstructorsConstructorDescriptionFull constructor specifying payload, metadata, scheduleId, and deadline.Schedule(Object payload, 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(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.@NonNull InstantThe time at which this scheduled message should be delivered.@NonNull StringUnique identifier for this scheduled message.reschedule(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(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, getTimestampMethods inherited from interface HasMetadata
chunked, getMetadata, lastChunk
-
Field Details
-
scheduleIdMetadataKey
Metadata key for the schedule identifier.
-
-
Constructor Details
-
Schedule
-
Schedule
-
Schedule
-
Schedule
-
-
Method Details
-
withPayload
Returns a new instance with the given payload.- Overrides:
withPayloadin classMessage
-
withMetadata
-
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.
-