Skip to content

Commit dc7a7e8

Browse files
Merge pull request #394 from nats-io/maurice/adr-51-cron-tz
ADR-51: Support time zones for Cron schedules
2 parents 94d3537 + 2a32402 commit dc7a7e8

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

adr/ADR-51.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
| Status | Approved |
88
| Tags | jetstream, 2.12 |
99

10-
11-
| Revision | Date | Author | Info |
12-
|----------|------------|------------|-----------------------------------------|
13-
| 1 | 2025-03-21 | @ripienaar | Document Initial Design |
14-
| 2 | 2025-09-30 | @ripienaar | Use `omitempty` on configuration fields |
10+
| Revision | Date | Author | Info |
11+
|----------|------------|-----------------|-----------------------------------------|
12+
| 1 | 2025-03-21 | @ripienaar | Document Initial Design |
13+
| 2 | 2025-09-30 | @ripienaar | Use `omitempty` on configuration fields |
14+
| 3 | 2026-01-05 | @MauriceVanVeen | Support time zones for cron |
1515

1616
## Context and Motivation
1717

@@ -136,12 +136,13 @@ Here the local site would produce high frequency temperature readings into `sens
136136
137137
These headers can be set on message that define a schedule:
138138
139-
| Header | Description |
140-
|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
141-
| `Nats-Schedule` | The schedule the message will be published on |
142-
| `Nats-Schedule-Target` | The subject the message will be delivered to |
143-
| `Nats-Schedule-Source` | Instructs the schedule to read the last message on the given subject and publish it. If the Subject is empty, nothing is published, wildcards are not supported |
144-
| `Nats-Schedule-TTL` | When publishing sets a TTL on the message if the stream supports per message TTLs | |
139+
| Header | Description |
140+
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
141+
| `Nats-Schedule` | The schedule the message will be published on |
142+
| `Nats-Schedule-Target` | The subject the message will be delivered to |
143+
| `Nats-Schedule-Source` | Instructs the schedule to read the last message on the given subject and publish it. If the Subject is empty, nothing is published, wildcards are not supported |
144+
| `Nats-Schedule-TTL` | When publishing sets a TTL on the message if the stream supports per message TTLs |
145+
| `Nats-Schedule-Time-Zone` | The time zone used for the Cron schedule. If not specified, the Cron schedule will be in UTC. Not allowed to be used if the schedule is not a Cron schedule. |
145146
146147
Messages that the Schedules produce will have these headers set in addition to any other headers on that was found in the message.
147148
@@ -157,6 +158,12 @@ Valid schedule header can match normal cron behavior as defined earlier
157158
158159
All time calculations will be done in UTC, a Cron schedule like `* 0 5 * * *` means exactly 5AM UTC.
159160
161+
Cron schedules may use different time zones, if specified in the `Nats-Schedule-Time-Zone` header. Although time zones
162+
are supported, it's not recommended to use Cron schedules that trigger during daylight saving time (DST) changes. If
163+
time moves forward due to DST, a schedule could be skipped if its time was not reached. If time moves backward due to
164+
DST, a schedule could be executed twice if its time was reached twice. Additionally, the server's time zones need to be
165+
kept up to date; otherwise servers might not run the Cron schedule at the expected time.
166+
160167
## Stream Configuration
161168
162169
#### Creating the stream.

0 commit comments

Comments
 (0)