Guide · Delayed delivery
Choose volatile or durable scheduling explicitly.
MyServiceBus keeps one familiar scheduling model across C# and Java, while making the selected provider's durability visible instead of hiding it behind the same API.
The default in-memory provider is lightweight and cancellable but loses pending work when the process exits. PostgreSQL Bus Outbox capture persists the final envelope and due time in the application transaction, then dispatches it when eligible.
Familiar concepts, platform-native APIs
C# follows the MassTransit-familiar IMessageScheduler, SchedulePublish, ScheduleSend, scheduled handle, and cancellation vocabulary. Java exposes the equivalent model with Instant, Duration, CompletionStage, and Java naming.
The default provider reports Volatile / VOLATILE. Successful scheduling means the local process accepted the timer—not that a broker or database accepted durable work.
Persist delayed intent with the outbox
Inside an active PostgreSQL Bus Outbox transaction, set the due time on the ordinary scoped publish or send context. MyServiceBus stores the serialized envelope immediately but does not lease it before the due time.
For the typed scheduler API, register the PostgreSQL provider before scheduling in the active transaction:
This path survives process restart and retains stable record and message identities. Cancel after the producing transaction commits. Cancellation and dispatcher leasing race atomically, so the result distinguishes cancellation from a dispatcher that already acquired the record. Repeated cancellation is idempotent.
Plug in a durable scheduling service
IScheduleMessageProvider in C# and ScheduleMessageProvider in Java are message-aware extension points. A provider can serialize and persist intent in an embedded scheduler, a broker-native scheduler, or an external service. The callback-level ILocalDelayScheduler / LocalDelayScheduler seam remains useful for in-process timing and deterministic tests, but callbacks cannot honestly be restart-safe.
The provider boundary is ready for an adapter. A production claim waits for persisted acceptance, restart recovery, due-time boundaries, cancellation races, and ambiguous-dispatch tests. Recurring schedules are also future work.
How this relates to MassTransit
MassTransit supports transport-based scheduling and service schedulers such as Quartz.NET and Hangfire. MyServiceBus preserves that useful distinction and familiar C# vocabulary. It deliberately adds an explicit volatile/durable capability and a corresponding Java provider contract. It does not yet claim MassTransit scheduler breadth or source-compatible scheduler providers.
Use MassTransit's scheduler guide as conceptual background, then use this page for the MyServiceBus guarantee.