Interface IMessageScheduler
Defines a service for scheduling messages to be delivered at a future time.
public interface IMessageScheduler
- Extension Methods
Methods
CancelAsync(string, CancellationToken)
Cancels a scheduled message.
Task<bool> CancelAsync(string scheduleId, CancellationToken cancellationToken)
Parameters
scheduleIdstringThe schedule identifier.
cancellationTokenCancellationTokenThe cancellation token.
Returns
CancelScheduledMessageAsync(string, CancellationToken)
Cancels a scheduled message (void return for backward compatibility).
Task CancelScheduledMessageAsync(string scheduleId, CancellationToken cancellationToken)
Parameters
scheduleIdstringThe schedule identifier.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task representing the asynchronous operation.
GetScheduleAsync(string, CancellationToken)
Gets information about a scheduled message.
Task<ScheduleInfo?> GetScheduleAsync(string scheduleId, CancellationToken cancellationToken)
Parameters
scheduleIdstringThe schedule identifier.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<ScheduleInfo>
The schedule information, or null if not found.
ScheduleAsync(IDispatchMessage, DateTimeOffset, CancellationToken)
Schedules a message to be delivered at the specified time.
Task<string> ScheduleAsync(IDispatchMessage message, DateTimeOffset scheduleTime, CancellationToken cancellationToken)
Parameters
messageIDispatchMessageThe message to schedule.
scheduleTimeDateTimeOffsetThe time when the message should be delivered.
cancellationTokenCancellationTokenThe cancellation token.
Returns
ScheduleMessageAsync<T>(T, DateTimeOffset, CancellationToken)
Schedules a message to be delivered at the specified time using a generic type.
Task<string> ScheduleMessageAsync<T>(T message, DateTimeOffset scheduledTime, CancellationToken cancellationToken)
Parameters
messageTThe message to schedule.
scheduledTimeDateTimeOffsetThe time when the message should be delivered.
cancellationTokenCancellationTokenThe cancellation token.
Returns
Type Parameters
TThe type of message to schedule.