Replies: 1 comment 1 reply
-
|
Per-publish options for message scheduling were released in v1.52.0 (for So your example should work (with minor tweak): js.Publish(ctx, scheduleSubject, payload, jetstream.WithScheduleAt(deadline),
jetstream.WithScheduleTarget(target),
jetstream.WithScheduleTTL(time.Hour),
)Unless you're using legacy API, all scheduling features available in nats-server v2.12.0 should be exposed as publish options. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
JetStream now supports server-side message scheduling via headers (
Nats-Schedule,Nats-Schedule-Target,Nats-Schedule-TTL,Nats-Schedule-Time-Zone, etc.) and theAllowMsgSchedulesstream option. The stream config field is already exposed innats.go, but there is no client-side helper to create or cancel a schedule.As a result, users have to set raw headers by hand and encode the pattern format themselves, e.g.:
This is error-prone and undiscoverable: the header names and pattern grammar (
@at,@every, cron, timezone constraints) are not represented anywhere in the Go API, so correct usage depends on reading server internals.Proposal
Mirror the existing
WithMsgTTLpattern and add scheduling asPublishOpts, with documented header constants and a small trigger helper that hides the pattern format:Questions for discussion
PublishOpts vs a higher-levelSchedulerinterface (Set/Cancel)?WithSchedule/ScheduleAtvsWithMsgSchedule/ScheduleTimeAt.I can make changes if we approve
Beta Was this translation helpful? Give feedback.
All reactions