mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
Both schedule parsers built their cron definition with cron-utils' default day-of-week field, which is Unix numbering: 0-6 for SUN-SAT. AWS numbers that field 1-7 for SUN-SAT, so every numeric day was read one day late and Saturday could not be expressed at all. cron(0 12 ? * 2 *) is Monday to AWS and fired on Tuesday. AWS's own documented example cron(15 10 ? * 6L 2022-2023), the last Friday of the month, fired on the last Saturday. cron(0 12 ? * 7 *) did not parse at all, failing with "Value 7 not in range [0, 6]". Day names were always correct, because cron-utils resolves them against its own numbering, so only expressions written with numbers were wrong. The definitions are at ScheduleExpressionParser.java:32 (eventbridge) and SchedulerExpressionParser.java:55 (scheduler). Both now pin the field with withValidRange(1, 7) and withMondayDoWValue(2), the same shape cron-utils uses for Quartz, whose day-of-week dialect AWS follows. 7 parses as Saturday, and 0 is rejected in line with AWS's documented 1-7 range. The existing eventbridge test getNextFireTimeFirstMondayOfMonth encoded the old behavior: it parsed cron(30 2 ? * 2#1 *), named itself for the first Monday, then asserted the fire day was a Tuesday. It now asserts 2026-03-02, which is the first Monday of that month.
5.4 KiB
5.4 KiB
EventBridge Scheduler
Protocol: REST JSON
Endpoint: http://localhost:4566/
Supported Actions
| Action | Method | Path | Description |
|---|---|---|---|
CreateScheduleGroup |
POST |
/schedule-groups/{Name} |
Create a schedule group |
GetScheduleGroup |
GET |
/schedule-groups/{Name} |
Get schedule group details |
DeleteScheduleGroup |
DELETE |
/schedule-groups/{Name} |
Delete a schedule group and its schedules |
ListScheduleGroups |
GET |
/schedule-groups |
List schedule groups |
CreateSchedule |
POST |
/schedules/{Name} |
Create a schedule |
GetSchedule |
GET |
/schedules/{Name} |
Get schedule details |
UpdateSchedule |
PUT |
/schedules/{Name} |
Update a schedule |
DeleteSchedule |
DELETE |
/schedules/{Name} |
Delete a schedule |
ListSchedules |
GET |
/schedules |
List schedules |
TagResource |
POST |
/tags/{ResourceArn} |
Add tags to a schedule group |
UntagResource |
DELETE |
/tags/{ResourceArn}?TagKeys=... |
Remove tags from a schedule group |
ListTagsForResource |
GET |
/tags/{ResourceArn} |
List tags on a schedule group |
Schedule Invocation
When floci.services.scheduler.invocation-enabled is true (the default), a
background dispatcher fires schedule targets on time. Supported expressions:
at(YYYY-MM-DDTHH:mm:ss)— one-time fire; honorsScheduleExpressionTimezone(default UTC) andActionAfterCompletion=DELETE.rate(N unit)— repeating fire (minutes,hours,days,weeks).cron(minute hour day-of-month month day-of-week year)— AWS 6-field cron; honorsScheduleExpressionTimezone. Day-of-week is1-7orSUN-SAT, so2is Monday andcron(30 2 ? * 2#1 *)is the first Monday of the month.
State=DISABLED schedules and schedules outside their StartDate/EndDate
window are skipped. The dispatcher ticks every
floci.services.scheduler.tick-interval-seconds (default 10).
Supported target types: SQS, Lambda, SNS, EventBridge PutEvents.
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_SCHEDULER_ENABLED |
true |
Enable or disable the service |
FLOCI_SERVICES_SCHEDULER_INVOCATION_ENABLED |
true |
Run the background dispatcher that fires scheduled targets (false = CRUD-only) |
FLOCI_SERVICES_SCHEDULER_TICK_INTERVAL_SECONDS |
10 |
How often the dispatcher scans for due schedules (seconds) |
Not Yet Supported
RetryPolicyandDeadLetterConfigon failed invocations (stored but not honored)FlexibleTimeWindowjitter (fires deterministically at the scheduled time)NextToken-based pagination for List operations
Examples
export AWS_ENDPOINT_URL=http://localhost:4566
# Create a schedule group
aws scheduler create-schedule-group \
--name my-group \
--endpoint-url $AWS_ENDPOINT_URL
# List schedule groups
aws scheduler list-schedule-groups \
--endpoint-url $AWS_ENDPOINT_URL
# Create a schedule in the default group
aws scheduler create-schedule \
--name my-schedule \
--schedule-expression "rate(1 hour)" \
--flexible-time-window '{"Mode":"OFF"}' \
--target '{
"Arn": "arn:aws:lambda:us-east-1:000000000000:function:my-func",
"RoleArn": "arn:aws:iam::000000000000:role/scheduler-role"
}' \
--endpoint-url $AWS_ENDPOINT_URL
# Create a schedule with retry policy and dead-letter queue
aws scheduler create-schedule \
--name my-resilient-schedule \
--schedule-expression "rate(5 minutes)" \
--flexible-time-window '{"Mode":"FLEXIBLE","MaximumWindowInMinutes":10}' \
--target '{
"Arn": "arn:aws:sqs:us-east-1:000000000000:my-queue",
"RoleArn": "arn:aws:iam::000000000000:role/scheduler-role",
"RetryPolicy": {"MaximumEventAgeInSeconds":3600,"MaximumRetryAttempts":5},
"DeadLetterConfig": {"Arn":"arn:aws:sqs:us-east-1:000000000000:my-dlq"}
}' \
--endpoint-url $AWS_ENDPOINT_URL
# Get a schedule
aws scheduler get-schedule \
--name my-schedule \
--endpoint-url $AWS_ENDPOINT_URL
# Update a schedule
aws scheduler update-schedule \
--name my-schedule \
--schedule-expression "rate(30 minutes)" \
--flexible-time-window '{"Mode":"OFF"}' \
--target '{
"Arn": "arn:aws:lambda:us-east-1:000000000000:function:my-func",
"RoleArn": "arn:aws:iam::000000000000:role/scheduler-role"
}' \
--state DISABLED \
--endpoint-url $AWS_ENDPOINT_URL
# Delete a schedule
aws scheduler delete-schedule \
--name my-schedule \
--endpoint-url $AWS_ENDPOINT_URL
# Delete a schedule group (cascades to all schedules in the group)
aws scheduler delete-schedule-group \
--name my-group \
--endpoint-url $AWS_ENDPOINT_URL
# Add tags to a schedule group (tags apply to schedule groups only)
aws scheduler tag-resource \
--resource-arn arn:aws:scheduler:us-east-1:000000000000:schedule-group/my-group \
--tags Key=env,Value=prod Key=owner,Value=Alice \
--endpoint-url $AWS_ENDPOINT_URL
# List tags on a schedule group
aws scheduler list-tags-for-resource \
--resource-arn arn:aws:scheduler:us-east-1:000000000000:schedule-group/my-group \
--endpoint-url $AWS_ENDPOINT_URL
# Remove tags from a schedule group
aws scheduler untag-resource \
--resource-arn arn:aws:scheduler:us-east-1:000000000000:schedule-group/my-group \
--tag-keys env owner \
--endpoint-url $AWS_ENDPOINT_URL
Default Schedule Group
A default schedule group is automatically created on first access. Schedules created without specifying a group are placed in the default group. The default group cannot be deleted.