Documentation
¶
Index ¶
- Variables
- type BusinessCalendar
- func (*BusinessCalendar) Descriptor() ([]byte, []int)deprecated
- func (x *BusinessCalendar) GetCalendarId() string
- func (x *BusinessCalendar) GetDescription() string
- func (x *BusinessCalendar) GetHolidays() []*Holiday
- func (x *BusinessCalendar) GetName() string
- func (x *BusinessCalendar) GetTimezone() string
- func (x *BusinessCalendar) GetWeekendDays() []int32
- func (*BusinessCalendar) ProtoMessage()
- func (x *BusinessCalendar) ProtoReflect() protoreflect.Message
- func (x *BusinessCalendar) Reset()
- func (x *BusinessCalendar) String() string
- type BusinessDaysRule
- func (*BusinessDaysRule) Descriptor() ([]byte, []int)deprecated
- func (x *BusinessDaysRule) GetBusinessCalendarId() string
- func (x *BusinessDaysRule) GetDayOffset() int32
- func (*BusinessDaysRule) ProtoMessage()
- func (x *BusinessDaysRule) ProtoReflect() protoreflect.Message
- func (x *BusinessDaysRule) Reset()
- func (x *BusinessDaysRule) String() string
- type CalendarException
- func (*CalendarException) Descriptor() ([]byte, []int)deprecated
- func (x *CalendarException) GetDate() *timestamppb.Timestamp
- func (x *CalendarException) GetExtraTimes() []*TimeOfDay
- func (x *CalendarException) GetReason() string
- func (x *CalendarException) GetRescheduleTo() *timestamppb.Timestamp
- func (x *CalendarException) GetType() CalendarException_ExceptionType
- func (*CalendarException) ProtoMessage()
- func (x *CalendarException) ProtoReflect() protoreflect.Message
- func (x *CalendarException) Reset()
- func (x *CalendarException) String() string
- type CalendarException_ExceptionType
- func (CalendarException_ExceptionType) Descriptor() protoreflect.EnumDescriptor
- func (x CalendarException_ExceptionType) Enum() *CalendarException_ExceptionType
- func (CalendarException_ExceptionType) EnumDescriptor() ([]byte, []int)deprecated
- func (x CalendarException_ExceptionType) Number() protoreflect.EnumNumber
- func (x CalendarException_ExceptionType) String() string
- func (CalendarException_ExceptionType) Type() protoreflect.EnumType
- type CalendarRule
- func (*CalendarRule) Descriptor() ([]byte, []int)deprecated
- func (x *CalendarRule) GetBusinessDays() *BusinessDaysRule
- func (x *CalendarRule) GetCustom() *CustomRule
- func (x *CalendarRule) GetDaily() *DailyRule
- func (x *CalendarRule) GetExecutionTimes() []*TimeOfDay
- func (x *CalendarRule) GetMonthly() *MonthlyRule
- func (x *CalendarRule) GetRule() isCalendarRule_Rule
- func (x *CalendarRule) GetValidFrom() *timestamppb.Timestamp
- func (x *CalendarRule) GetValidUntil() *timestamppb.Timestamp
- func (x *CalendarRule) GetWeekly() *WeeklyRule
- func (x *CalendarRule) GetYearly() *YearlyRule
- func (*CalendarRule) ProtoMessage()
- func (x *CalendarRule) ProtoReflect() protoreflect.Message
- func (x *CalendarRule) Reset()
- func (x *CalendarRule) String() string
- type CalendarRule_BusinessDays
- type CalendarRule_Custom
- type CalendarRule_Daily
- type CalendarRule_Monthly
- type CalendarRule_Weekly
- type CalendarRule_Yearly
- type CalendarSchedule
- func (*CalendarSchedule) Descriptor() ([]byte, []int)deprecated
- func (x *CalendarSchedule) GetBusinessCalendar() *BusinessCalendar
- func (x *CalendarSchedule) GetExceptions() []*CalendarException
- func (x *CalendarSchedule) GetRules() []*CalendarRule
- func (x *CalendarSchedule) GetTimezone() string
- func (x *CalendarSchedule) GetType() CalendarSchedule_ScheduleType
- func (*CalendarSchedule) ProtoMessage()
- func (x *CalendarSchedule) ProtoReflect() protoreflect.Message
- func (x *CalendarSchedule) Reset()
- func (x *CalendarSchedule) String() string
- type CalendarSchedule_ScheduleType
- func (CalendarSchedule_ScheduleType) Descriptor() protoreflect.EnumDescriptor
- func (x CalendarSchedule_ScheduleType) Enum() *CalendarSchedule_ScheduleType
- func (CalendarSchedule_ScheduleType) EnumDescriptor() ([]byte, []int)deprecated
- func (x CalendarSchedule_ScheduleType) Number() protoreflect.EnumNumber
- func (x CalendarSchedule_ScheduleType) String() string
- func (CalendarSchedule_ScheduleType) Type() protoreflect.EnumType
- type CustomRule
- func (*CustomRule) Descriptor() ([]byte, []int)deprecated
- func (x *CustomRule) GetExpression() string
- func (x *CustomRule) GetParameters() map[string]string
- func (x *CustomRule) GetRuleType() string
- func (*CustomRule) ProtoMessage()
- func (x *CustomRule) ProtoReflect() protoreflect.Message
- func (x *CustomRule) Reset()
- func (x *CustomRule) String() string
- type DailyRule
- func (*DailyRule) Descriptor() ([]byte, []int)deprecated
- func (x *DailyRule) GetDayInterval() int32
- func (x *DailyRule) GetStartDate() *timestamppb.Timestamp
- func (x *DailyRule) GetWeekdaysOnly() bool
- func (*DailyRule) ProtoMessage()
- func (x *DailyRule) ProtoReflect() protoreflect.Message
- func (x *DailyRule) Reset()
- func (x *DailyRule) String() string
- type EasterOffset
- type FixedDate
- type Holiday
- func (*Holiday) Descriptor() ([]byte, []int)deprecated
- func (x *Holiday) GetDate() *timestamppb.Timestamp
- func (x *Holiday) GetName() string
- func (x *Holiday) GetRecurringYearly() bool
- func (x *Holiday) GetRule() *HolidayRule
- func (*Holiday) ProtoMessage()
- func (x *Holiday) ProtoReflect() protoreflect.Message
- func (x *Holiday) Reset()
- func (x *Holiday) String() string
- type HolidayRule
- func (*HolidayRule) Descriptor() ([]byte, []int)deprecated
- func (x *HolidayRule) GetEasterOffset() *EasterOffset
- func (x *HolidayRule) GetFixed() *FixedDate
- func (x *HolidayRule) GetRelative() *RelativeDate
- func (x *HolidayRule) GetRule() isHolidayRule_Rule
- func (*HolidayRule) ProtoMessage()
- func (x *HolidayRule) ProtoReflect() protoreflect.Message
- func (x *HolidayRule) Reset()
- func (x *HolidayRule) String() string
- type HolidayRule_EasterOffset
- type HolidayRule_Fixed
- type HolidayRule_Relative
- type MonthlyRule
- func (*MonthlyRule) Descriptor() ([]byte, []int)deprecated
- func (x *MonthlyRule) GetDayType() MonthlyRule_DayType
- func (x *MonthlyRule) GetDayValue() int32
- func (x *MonthlyRule) GetMonths() []int32
- func (x *MonthlyRule) GetOccurrence() int32
- func (*MonthlyRule) ProtoMessage()
- func (x *MonthlyRule) ProtoReflect() protoreflect.Message
- func (x *MonthlyRule) Reset()
- func (x *MonthlyRule) String() string
- type MonthlyRule_DayType
- func (MonthlyRule_DayType) Descriptor() protoreflect.EnumDescriptor
- func (x MonthlyRule_DayType) Enum() *MonthlyRule_DayType
- func (MonthlyRule_DayType) EnumDescriptor() ([]byte, []int)deprecated
- func (x MonthlyRule_DayType) Number() protoreflect.EnumNumber
- func (x MonthlyRule_DayType) String() string
- func (MonthlyRule_DayType) Type() protoreflect.EnumType
- type RelativeDate
- func (*RelativeDate) Descriptor() ([]byte, []int)deprecated
- func (x *RelativeDate) GetMonth() int32
- func (x *RelativeDate) GetOccurrence() int32
- func (x *RelativeDate) GetWeekday() int32
- func (*RelativeDate) ProtoMessage()
- func (x *RelativeDate) ProtoReflect() protoreflect.Message
- func (x *RelativeDate) Reset()
- func (x *RelativeDate) String() string
- type Schedule
- type ScheduleHistory
- func (*ScheduleHistory) Descriptor() ([]byte, []int)deprecated
- func (x *ScheduleHistory) GetCreatedAt() *timestamppb.Timestamp
- func (x *ScheduleHistory) GetLastRun() *timestamppb.Timestamp
- func (x *ScheduleHistory) GetMessages() []*v1.Message
- func (x *ScheduleHistory) GetNextRun() *timestamppb.Timestamp
- func (x *ScheduleHistory) GetScheduleId() string
- func (x *ScheduleHistory) GetUpdatedAt() *timestamppb.Timestamp
- func (*ScheduleHistory) ProtoMessage()
- func (x *ScheduleHistory) ProtoReflect() protoreflect.Message
- func (x *ScheduleHistory) Reset()
- func (x *ScheduleHistory) String() string
- type Schedule_Metadata
- func (*Schedule_Metadata) Descriptor() ([]byte, []int)deprecated
- func (x *Schedule_Metadata) GetCalendarSchedule() *CalendarSchedule
- func (x *Schedule_Metadata) GetCreatedAt() *timestamppb.Timestamp
- func (x *Schedule_Metadata) GetCronSchedule() string
- func (x *Schedule_Metadata) GetExclusivityKey() string
- func (x *Schedule_Metadata) GetHasMaxMessages() bool
- func (x *Schedule_Metadata) GetLastRun() *timestamppb.Timestamp
- func (x *Schedule_Metadata) GetLeaseDuration() *durationpb.Duration
- func (x *Schedule_Metadata) GetMaxMessages() int64
- func (x *Schedule_Metadata) GetMessageIds() []string
- func (x *Schedule_Metadata) GetNextRun() *timestamppb.Timestamp
- func (x *Schedule_Metadata) GetNextRuns() []*timestamppb.Timestamp
- func (x *Schedule_Metadata) GetPayload() *v11.Payload
- func (x *Schedule_Metadata) GetPriority() int64
- func (x *Schedule_Metadata) GetQueueName() string
- func (x *Schedule_Metadata) GetScheduleConfig() isSchedule_Metadata_ScheduleConfig
- func (x *Schedule_Metadata) GetState() Schedule_Metadata_State
- func (x *Schedule_Metadata) GetStateMessage() string
- func (x *Schedule_Metadata) GetTimezone() string
- func (x *Schedule_Metadata) GetUpdatedAt() *timestamppb.Timestamp
- func (*Schedule_Metadata) ProtoMessage()
- func (x *Schedule_Metadata) ProtoReflect() protoreflect.Message
- func (x *Schedule_Metadata) Reset()
- func (x *Schedule_Metadata) String() string
- type Schedule_Metadata_CalendarSchedule
- type Schedule_Metadata_CronSchedule
- type Schedule_Metadata_State
- func (Schedule_Metadata_State) Descriptor() protoreflect.EnumDescriptor
- func (x Schedule_Metadata_State) Enum() *Schedule_Metadata_State
- func (Schedule_Metadata_State) EnumDescriptor() ([]byte, []int)deprecated
- func (x Schedule_Metadata_State) Number() protoreflect.EnumNumber
- func (x Schedule_Metadata_State) String() string
- func (Schedule_Metadata_State) Type() protoreflect.EnumType
- type TimeOfDay
- func (*TimeOfDay) Descriptor() ([]byte, []int)deprecated
- func (x *TimeOfDay) GetHour() int32
- func (x *TimeOfDay) GetMinute() int32
- func (x *TimeOfDay) GetSecond() int32
- func (*TimeOfDay) ProtoMessage()
- func (x *TimeOfDay) ProtoReflect() protoreflect.Message
- func (x *TimeOfDay) Reset()
- func (x *TimeOfDay) String() string
- type WeeklyRule
- func (*WeeklyRule) Descriptor() ([]byte, []int)deprecated
- func (x *WeeklyRule) GetDaysOfWeek() []int32
- func (x *WeeklyRule) GetStartWeek() *timestamppb.Timestamp
- func (x *WeeklyRule) GetWeekInterval() int32
- func (*WeeklyRule) ProtoMessage()
- func (x *WeeklyRule) ProtoReflect() protoreflect.Message
- func (x *WeeklyRule) Reset()
- func (x *WeeklyRule) String() string
- type YearlyRule
- func (*YearlyRule) Descriptor() ([]byte, []int)deprecated
- func (x *YearlyRule) GetAdjustForLeapYear() bool
- func (x *YearlyRule) GetDay() int32
- func (x *YearlyRule) GetMonth() int32
- func (*YearlyRule) ProtoMessage()
- func (x *YearlyRule) ProtoReflect() protoreflect.Message
- func (x *YearlyRule) Reset()
- func (x *YearlyRule) String() string
Constants ¶
This section is empty.
Variables ¶
var ( Schedule_Metadata_State_name = map[int32]string{ 0: "SCHEDULED", 1: "CANCELED", 2: "ERRORED", 3: "PAUSED", } Schedule_Metadata_State_value = map[string]int32{ "SCHEDULED": 0, "CANCELED": 1, "ERRORED": 2, "PAUSED": 3, } )
Enum value maps for Schedule_Metadata_State.
var ( CalendarSchedule_ScheduleType_name = map[int32]string{ 0: "MONTHLY", 1: "WEEKLY", 2: "DAILY", 3: "YEARLY", 4: "BUSINESS_DAYS", 5: "CUSTOM", } CalendarSchedule_ScheduleType_value = map[string]int32{ "MONTHLY": 0, "WEEKLY": 1, "DAILY": 2, "YEARLY": 3, "BUSINESS_DAYS": 4, "CUSTOM": 5, } )
Enum value maps for CalendarSchedule_ScheduleType.
var ( MonthlyRule_DayType_name = map[int32]string{ 0: "DAY_OF_MONTH", 1: "WEEKDAY_OF_MONTH", 2: "LAST_WEEKDAY", 3: "LAST_DAY", } MonthlyRule_DayType_value = map[string]int32{ "DAY_OF_MONTH": 0, "WEEKDAY_OF_MONTH": 1, "LAST_WEEKDAY": 2, "LAST_DAY": 3, } )
Enum value maps for MonthlyRule_DayType.
var ( CalendarException_ExceptionType_name = map[int32]string{ 0: "SKIP", 1: "RESCHEDULE", 2: "EXTRA", } CalendarException_ExceptionType_value = map[string]int32{ "SKIP": 0, "RESCHEDULE": 1, "EXTRA": 2, } )
Enum value maps for CalendarException_ExceptionType.
var File_proto_schedule_v1_schedule_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type BusinessCalendar ¶
type BusinessCalendar struct {
// calendar_id: Unique identifier for this calendar.
// Referenced by BusinessDaysRule.business_calendar_id.
CalendarId string `protobuf:"bytes,1,opt,name=calendar_id,json=calendarId,proto3" json:"calendar_id,omitempty"`
// name: Human-readable name.
// Example: "US Federal Holidays", "UK Bank Holidays", "ACME Corp Custom Calendar"
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
// description: Optional detailed description.
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
// holidays: List of holidays (days to skip for business day schedules).
// Can be fixed dates (Dec 25) or relative (first Monday in May).
Holidays []*Holiday `protobuf:"bytes,4,rep,name=holidays,proto3" json:"holidays,omitempty"`
// weekend_days: Days considered weekends (1=Monday, 7=Sunday).
// Common values:
//
// [6, 7] = Saturday, Sunday (most countries)
// [5, 6] = Friday, Saturday (some Middle Eastern countries)
// [7] = Sunday only
WeekendDays []int32 `protobuf:"varint,5,rep,packed,name=weekend_days,json=weekendDays,proto3" json:"weekend_days,omitempty"`
// timezone: IANA timezone for this calendar.
// Affects date boundaries for holidays.
Timezone string `protobuf:"bytes,6,opt,name=timezone,proto3" json:"timezone,omitempty"`
// contains filtered or unexported fields
}
BusinessCalendar defines holidays and weekends for a region/organization. Used by BusinessDaysRule to determine working vs non-working days.
Example - US federal holidays:
calendar := &schedule.BusinessCalendar{
CalendarId: "us-federal",
Name: "US Federal Holidays",
Holidays: []*schedule.Holiday{
{Name: "New Year's Day", Rule: &schedule.HolidayRule{...}},
{Name: "Independence Day", Rule: &schedule.HolidayRule{...}},
{Name: "Thanksgiving", Rule: &schedule.HolidayRule{...}},
// ... more holidays
},
WeekendDays: []int32{6, 7}, // Saturday, Sunday
Timezone: "America/New_York",
}
func (*BusinessCalendar) Descriptor
deprecated
func (*BusinessCalendar) Descriptor() ([]byte, []int)
Deprecated: Use BusinessCalendar.ProtoReflect.Descriptor instead.
func (*BusinessCalendar) GetCalendarId ¶
func (x *BusinessCalendar) GetCalendarId() string
func (*BusinessCalendar) GetDescription ¶
func (x *BusinessCalendar) GetDescription() string
func (*BusinessCalendar) GetHolidays ¶
func (x *BusinessCalendar) GetHolidays() []*Holiday
func (*BusinessCalendar) GetName ¶
func (x *BusinessCalendar) GetName() string
func (*BusinessCalendar) GetTimezone ¶
func (x *BusinessCalendar) GetTimezone() string
func (*BusinessCalendar) GetWeekendDays ¶
func (x *BusinessCalendar) GetWeekendDays() []int32
func (*BusinessCalendar) ProtoMessage ¶
func (*BusinessCalendar) ProtoMessage()
func (*BusinessCalendar) ProtoReflect ¶
func (x *BusinessCalendar) ProtoReflect() protoreflect.Message
func (*BusinessCalendar) Reset ¶
func (x *BusinessCalendar) Reset()
func (*BusinessCalendar) String ¶
func (x *BusinessCalendar) String() string
type BusinessDaysRule ¶
type BusinessDaysRule struct {
// business_calendar_id: Reference to BusinessCalendar defining holidays/weekends.
// Must match a calendar_id in CalendarSchedule.business_calendar.
BusinessCalendarId string `protobuf:"bytes,1,opt,name=business_calendar_id,json=businessCalendarId,proto3" json:"business_calendar_id,omitempty"`
// day_offset: Offset from business day.
// 0 = on business day
// -1 = day before business day (useful for overnight prep jobs)
// 1 = day after business day
// Note: Offset day might land on non-business day; schedule skips those.
DayOffset int32 `protobuf:"varint,2,opt,name=day_offset,json=dayOffset,proto3" json:"day_offset,omitempty"`
// contains filtered or unexported fields
}
BusinessDaysRule schedules execution on business days (non-holidays, non-weekends).
Examples:
Every business day:
{business_calendar_id: "us-holidays"}
Day before each business day (for overnight processing):
{business_calendar_id: "us-holidays", day_offset: -1}
Day after each business day:
{business_calendar_id: "us-holidays", day_offset: 1}
func (*BusinessDaysRule) Descriptor
deprecated
func (*BusinessDaysRule) Descriptor() ([]byte, []int)
Deprecated: Use BusinessDaysRule.ProtoReflect.Descriptor instead.
func (*BusinessDaysRule) GetBusinessCalendarId ¶
func (x *BusinessDaysRule) GetBusinessCalendarId() string
func (*BusinessDaysRule) GetDayOffset ¶
func (x *BusinessDaysRule) GetDayOffset() int32
func (*BusinessDaysRule) ProtoMessage ¶
func (*BusinessDaysRule) ProtoMessage()
func (*BusinessDaysRule) ProtoReflect ¶
func (x *BusinessDaysRule) ProtoReflect() protoreflect.Message
func (*BusinessDaysRule) Reset ¶
func (x *BusinessDaysRule) Reset()
func (*BusinessDaysRule) String ¶
func (x *BusinessDaysRule) String() string
type CalendarException ¶
type CalendarException struct {
// date: Date this exception applies to.
Date *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
// type: What kind of exception to apply.
Type CalendarException_ExceptionType `` /* 127-byte string literal not displayed */
// reschedule_to: Target date for RESCHEDULE exceptions.
// Required if type = RESCHEDULE.
RescheduleTo *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=reschedule_to,json=rescheduleTo,proto3" json:"reschedule_to,omitempty"`
// extra_times: Additional execution times for EXTRA exceptions.
// Applied in addition to regular schedule.
// Required if type = EXTRA.
ExtraTimes []*TimeOfDay `protobuf:"bytes,4,rep,name=extra_times,json=extraTimes,proto3" json:"extra_times,omitempty"`
// reason: Optional explanation for this exception.
// Useful for documentation and auditing.
// Example: "System maintenance", "Holiday adjustment", "Special event"
Reason string `protobuf:"bytes,5,opt,name=reason,proto3" json:"reason,omitempty"`
// contains filtered or unexported fields
}
CalendarException modifies schedule behavior for a specific date. Use for one-off changes without modifying the core schedule.
Examples:
Skip execution during maintenance:
{date: "2024-06-15", type: SKIP, reason: "System maintenance"}
Reschedule monthly report when month-end is holiday:
{date: "2024-12-31", type: RESCHEDULE, reschedule_to: "2024-12-30", reason: "New Year's Eve"}
Add extra execution for special event:
{date: "2024-11-29", type: EXTRA, extra_times: [{hour: 14}], reason: "Black Friday promotions"}
func (*CalendarException) Descriptor
deprecated
func (*CalendarException) Descriptor() ([]byte, []int)
Deprecated: Use CalendarException.ProtoReflect.Descriptor instead.
func (*CalendarException) GetDate ¶
func (x *CalendarException) GetDate() *timestamppb.Timestamp
func (*CalendarException) GetExtraTimes ¶
func (x *CalendarException) GetExtraTimes() []*TimeOfDay
func (*CalendarException) GetReason ¶
func (x *CalendarException) GetReason() string
func (*CalendarException) GetRescheduleTo ¶
func (x *CalendarException) GetRescheduleTo() *timestamppb.Timestamp
func (*CalendarException) GetType ¶
func (x *CalendarException) GetType() CalendarException_ExceptionType
func (*CalendarException) ProtoMessage ¶
func (*CalendarException) ProtoMessage()
func (*CalendarException) ProtoReflect ¶
func (x *CalendarException) ProtoReflect() protoreflect.Message
func (*CalendarException) Reset ¶
func (x *CalendarException) Reset()
func (*CalendarException) String ¶
func (x *CalendarException) String() string
type CalendarException_ExceptionType ¶
type CalendarException_ExceptionType int32
ExceptionType determines how to modify the schedule.
const ( CalendarException_SKIP CalendarException_ExceptionType = 0 // Don't execute on this date CalendarException_RESCHEDULE CalendarException_ExceptionType = 1 // Move execution to a different date CalendarException_EXTRA CalendarException_ExceptionType = 2 // Add additional execution(s) on this date )
func (CalendarException_ExceptionType) Descriptor ¶
func (CalendarException_ExceptionType) Descriptor() protoreflect.EnumDescriptor
func (CalendarException_ExceptionType) Enum ¶
func (x CalendarException_ExceptionType) Enum() *CalendarException_ExceptionType
func (CalendarException_ExceptionType) EnumDescriptor
deprecated
func (CalendarException_ExceptionType) EnumDescriptor() ([]byte, []int)
Deprecated: Use CalendarException_ExceptionType.Descriptor instead.
func (CalendarException_ExceptionType) Number ¶
func (x CalendarException_ExceptionType) Number() protoreflect.EnumNumber
func (CalendarException_ExceptionType) String ¶
func (x CalendarException_ExceptionType) String() string
func (CalendarException_ExceptionType) Type ¶
func (CalendarException_ExceptionType) Type() protoreflect.EnumType
type CalendarRule ¶
type CalendarRule struct {
// rule: Date pattern determining which days to execute.
// Choose one based on CalendarSchedule.type.
//
// Types that are valid to be assigned to Rule:
//
// *CalendarRule_Monthly
// *CalendarRule_Weekly
// *CalendarRule_Daily
// *CalendarRule_Yearly
// *CalendarRule_BusinessDays
// *CalendarRule_Custom
Rule isCalendarRule_Rule `protobuf_oneof:"rule"`
// execution_times: What time(s) of day to execute on matching dates.
// Multiple times = multiple executions per day.
// Examples:
//
// [{hour:9}] = once at 9 AM
// [{hour:8}, {hour:12}, {hour:17}] = three times daily
//
// If empty, defaults to midnight (00:00:00).
ExecutionTimes []*TimeOfDay `protobuf:"bytes,7,rep,name=execution_times,json=executionTimes,proto3" json:"execution_times,omitempty"`
// valid_from: Start date for this rule (inclusive).
// Rule only applies on or after this date.
// Use for seasonal schedules or phased rollouts.
ValidFrom *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=valid_from,json=validFrom,proto3" json:"valid_from,omitempty"`
// valid_until: End date for this rule (inclusive).
// Rule only applies on or before this date.
// Use for limited-time campaigns or temporary schedules.
ValidUntil *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=valid_until,json=validUntil,proto3" json:"valid_until,omitempty"`
// contains filtered or unexported fields
}
CalendarRule defines a specific scheduling pattern within a CalendarSchedule. Each rule specifies WHEN (date pattern) and WHAT TIME (execution_times) to run.
Example - Every Monday and Wednesday at 9 AM:
rule := &schedule.CalendarRule{
Rule: &schedule.CalendarRule_Weekly{
Weekly: &schedule.WeeklyRule{
DaysOfWeek: []int32{1, 3}, // Monday, Wednesday
},
},
ExecutionTimes: []*schedule.TimeOfDay{{Hour: 9}},
}
Example - First day of every quarter at midnight:
rule := &schedule.CalendarRule{
Rule: &schedule.CalendarRule_Monthly{
Monthly: &schedule.MonthlyRule{
DayType: schedule.MonthlyRule_DAY_OF_MONTH,
DayValue: 1,
Months: []int32{1, 4, 7, 10}, // Jan, Apr, Jul, Oct
},
},
ExecutionTimes: []*schedule.TimeOfDay{{Hour: 0}},
}
func (*CalendarRule) Descriptor
deprecated
func (*CalendarRule) Descriptor() ([]byte, []int)
Deprecated: Use CalendarRule.ProtoReflect.Descriptor instead.
func (*CalendarRule) GetBusinessDays ¶
func (x *CalendarRule) GetBusinessDays() *BusinessDaysRule
func (*CalendarRule) GetCustom ¶
func (x *CalendarRule) GetCustom() *CustomRule
func (*CalendarRule) GetDaily ¶
func (x *CalendarRule) GetDaily() *DailyRule
func (*CalendarRule) GetExecutionTimes ¶
func (x *CalendarRule) GetExecutionTimes() []*TimeOfDay
func (*CalendarRule) GetMonthly ¶
func (x *CalendarRule) GetMonthly() *MonthlyRule
func (*CalendarRule) GetRule ¶
func (x *CalendarRule) GetRule() isCalendarRule_Rule
func (*CalendarRule) GetValidFrom ¶
func (x *CalendarRule) GetValidFrom() *timestamppb.Timestamp
func (*CalendarRule) GetValidUntil ¶
func (x *CalendarRule) GetValidUntil() *timestamppb.Timestamp
func (*CalendarRule) GetWeekly ¶
func (x *CalendarRule) GetWeekly() *WeeklyRule
func (*CalendarRule) GetYearly ¶
func (x *CalendarRule) GetYearly() *YearlyRule
func (*CalendarRule) ProtoMessage ¶
func (*CalendarRule) ProtoMessage()
func (*CalendarRule) ProtoReflect ¶
func (x *CalendarRule) ProtoReflect() protoreflect.Message
func (*CalendarRule) Reset ¶
func (x *CalendarRule) Reset()
func (*CalendarRule) String ¶
func (x *CalendarRule) String() string
type CalendarRule_BusinessDays ¶
type CalendarRule_BusinessDays struct {
BusinessDays *BusinessDaysRule `protobuf:"bytes,5,opt,name=business_days,json=businessDays,proto3,oneof"` // For BUSINESS_DAYS schedules
}
type CalendarRule_Custom ¶
type CalendarRule_Custom struct {
Custom *CustomRule `protobuf:"bytes,6,opt,name=custom,proto3,oneof"` // For CUSTOM schedules
}
type CalendarRule_Daily ¶
type CalendarRule_Daily struct {
Daily *DailyRule `protobuf:"bytes,3,opt,name=daily,proto3,oneof"` // For DAILY schedules
}
type CalendarRule_Monthly ¶
type CalendarRule_Monthly struct {
Monthly *MonthlyRule `protobuf:"bytes,1,opt,name=monthly,proto3,oneof"` // For MONTHLY schedules
}
type CalendarRule_Weekly ¶
type CalendarRule_Weekly struct {
Weekly *WeeklyRule `protobuf:"bytes,2,opt,name=weekly,proto3,oneof"` // For WEEKLY schedules
}
type CalendarRule_Yearly ¶
type CalendarRule_Yearly struct {
Yearly *YearlyRule `protobuf:"bytes,4,opt,name=yearly,proto3,oneof"` // For YEARLY schedules
}
type CalendarSchedule ¶
type CalendarSchedule struct {
// type: Primary scheduling pattern.
// Constrains which rule types can be used in rules field.
Type CalendarSchedule_ScheduleType `protobuf:"varint,1,opt,name=type,proto3,enum=chronoqueue.api.schedule.v1.CalendarSchedule_ScheduleType" json:"type,omitempty"`
// rules: Specific scheduling rules (when to execute).
// Multiple rules = union of all matching times.
// Example: Two rules for "weekdays at 9 AM" and "weekdays at 5 PM"
Rules []*CalendarRule `protobuf:"bytes,2,rep,name=rules,proto3" json:"rules,omitempty"`
// timezone: IANA timezone for all time calculations.
// Examples: "America/New_York", "Europe/London", "Asia/Tokyo"
// Affects DST transitions, date boundaries, execution times.
// Required for calendar schedules.
Timezone string `protobuf:"bytes,3,opt,name=timezone,proto3" json:"timezone,omitempty"`
// business_calendar: Holiday and weekend definitions.
// Used by BUSINESS_DAYS schedules to skip non-working days.
// Can include country-specific holidays, custom company holidays.
BusinessCalendar *BusinessCalendar `protobuf:"bytes,4,opt,name=business_calendar,json=businessCalendar,proto3" json:"business_calendar,omitempty"`
// exceptions: Override schedule for specific dates.
// Use cases:
// - Skip execution during maintenance windows
// - Reschedule monthly report when month-end is holiday
// - Add extra execution for one-time events
Exceptions []*CalendarException `protobuf:"bytes,5,rep,name=exceptions,proto3" json:"exceptions,omitempty"`
// contains filtered or unexported fields
}
CalendarSchedule defines rich business calendar-based scheduling.
Supports complex scheduling patterns: - Business days only (skip weekends and holidays) - Relative dates (first Monday of month, last Friday) - Custom calendars per region/country - Exception handling (skip/reschedule specific dates) - Multiple execution times per day
Example - Monthly reports on first business day at 8 AM and 5 PM:
calendar := &schedule.CalendarSchedule{
Type: schedule.CalendarSchedule_BUSINESS_DAYS,
Rules: []*schedule.CalendarRule{{
BusinessDays: &schedule.BusinessDaysRule{
BusinessCalendarId: "us-holidays",
},
ExecutionTimes: []*schedule.TimeOfDay{
{Hour: 8, Minute: 0},
{Hour: 17, Minute: 0},
},
}},
Timezone: "America/New_York",
BusinessCalendar: usHolidaysCalendar,
}
Example - Quarterly board meeting (last Friday of Mar/Jun/Sep/Dec at 2 PM):
calendar := &schedule.CalendarSchedule{
Type: schedule.CalendarSchedule_MONTHLY,
Rules: []*schedule.CalendarRule{{
Monthly: &schedule.MonthlyRule{
DayType: schedule.MonthlyRule_LAST_WEEKDAY,
DayValue: 5, // Friday
Months: []int32{3, 6, 9, 12}, // Q1, Q2, Q3, Q4
},
ExecutionTimes: []*schedule.TimeOfDay{{Hour: 14}},
}},
Timezone: "America/Los_Angeles",
}
func (*CalendarSchedule) Descriptor
deprecated
func (*CalendarSchedule) Descriptor() ([]byte, []int)
Deprecated: Use CalendarSchedule.ProtoReflect.Descriptor instead.
func (*CalendarSchedule) GetBusinessCalendar ¶
func (x *CalendarSchedule) GetBusinessCalendar() *BusinessCalendar
func (*CalendarSchedule) GetExceptions ¶
func (x *CalendarSchedule) GetExceptions() []*CalendarException
func (*CalendarSchedule) GetRules ¶
func (x *CalendarSchedule) GetRules() []*CalendarRule
func (*CalendarSchedule) GetTimezone ¶
func (x *CalendarSchedule) GetTimezone() string
func (*CalendarSchedule) GetType ¶
func (x *CalendarSchedule) GetType() CalendarSchedule_ScheduleType
func (*CalendarSchedule) ProtoMessage ¶
func (*CalendarSchedule) ProtoMessage()
func (*CalendarSchedule) ProtoReflect ¶
func (x *CalendarSchedule) ProtoReflect() protoreflect.Message
func (*CalendarSchedule) Reset ¶
func (x *CalendarSchedule) Reset()
func (*CalendarSchedule) String ¶
func (x *CalendarSchedule) String() string
type CalendarSchedule_ScheduleType ¶
type CalendarSchedule_ScheduleType int32
ScheduleType categorizes the primary scheduling pattern. Determines which rule types are applicable.
const ( CalendarSchedule_MONTHLY CalendarSchedule_ScheduleType = 0 // Executes monthly (1st of month, last Friday, etc.) CalendarSchedule_WEEKLY CalendarSchedule_ScheduleType = 1 // Executes weekly (every Monday, bi-weekly, etc.) CalendarSchedule_DAILY CalendarSchedule_ScheduleType = 2 // Executes daily (every day, weekdays only, etc.) CalendarSchedule_YEARLY CalendarSchedule_ScheduleType = 3 // Executes yearly (birthdays, anniversaries, annual reports) CalendarSchedule_BUSINESS_DAYS CalendarSchedule_ScheduleType = 4 // Executes on business days (respects holidays/weekends) CalendarSchedule_CUSTOM CalendarSchedule_ScheduleType = 5 // Custom logic via expression language )
func (CalendarSchedule_ScheduleType) Descriptor ¶
func (CalendarSchedule_ScheduleType) Descriptor() protoreflect.EnumDescriptor
func (CalendarSchedule_ScheduleType) Enum ¶
func (x CalendarSchedule_ScheduleType) Enum() *CalendarSchedule_ScheduleType
func (CalendarSchedule_ScheduleType) EnumDescriptor
deprecated
func (CalendarSchedule_ScheduleType) EnumDescriptor() ([]byte, []int)
Deprecated: Use CalendarSchedule_ScheduleType.Descriptor instead.
func (CalendarSchedule_ScheduleType) Number ¶
func (x CalendarSchedule_ScheduleType) Number() protoreflect.EnumNumber
func (CalendarSchedule_ScheduleType) String ¶
func (x CalendarSchedule_ScheduleType) String() string
func (CalendarSchedule_ScheduleType) Type ¶
func (CalendarSchedule_ScheduleType) Type() protoreflect.EnumType
type CustomRule ¶
type CustomRule struct {
// expression: Custom scheduling expression.
// Format depends on rule_type. See ChronoQueue documentation for supported expressions.
Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
// rule_type: Identifies which custom rule processor to use.
// Built-in types: "business_calendar_expression", "lua_expression"
// Extensible via server plugins.
RuleType string `protobuf:"bytes,2,opt,name=rule_type,json=ruleType,proto3" json:"rule_type,omitempty"`
// parameters: Additional configuration for the rule processor.
// Contents depend on rule_type.
Parameters map[string]string `` /* 147-byte string literal not displayed */
// contains filtered or unexported fields
}
CustomRule allows complex scheduling logic via custom expressions. Useful when built-in rules don't support your use case.
Example - Last business day of each quarter:
{
expression: "last_business_day_of_quarter",
rule_type: "business_calendar_expression",
parameters: {"calendar_id": "us-holidays", "quarters": "1,2,3,4"}
}
func (*CustomRule) Descriptor
deprecated
func (*CustomRule) Descriptor() ([]byte, []int)
Deprecated: Use CustomRule.ProtoReflect.Descriptor instead.
func (*CustomRule) GetExpression ¶
func (x *CustomRule) GetExpression() string
func (*CustomRule) GetParameters ¶
func (x *CustomRule) GetParameters() map[string]string
func (*CustomRule) GetRuleType ¶
func (x *CustomRule) GetRuleType() string
func (*CustomRule) ProtoMessage ¶
func (*CustomRule) ProtoMessage()
func (*CustomRule) ProtoReflect ¶
func (x *CustomRule) ProtoReflect() protoreflect.Message
func (*CustomRule) Reset ¶
func (x *CustomRule) Reset()
func (*CustomRule) String ¶
func (x *CustomRule) String() string
type DailyRule ¶
type DailyRule struct {
// day_interval: Execute every Nth day.
// 1 = every day, 2 = every other day, 7 = weekly
// Default: 1
DayInterval int32 `protobuf:"varint,1,opt,name=day_interval,json=dayInterval,proto3" json:"day_interval,omitempty"`
// weekdays_only: If true, skip weekends (Saturday and Sunday).
// Applies after day_interval calculation.
// Example: {day_interval: 1, weekdays_only: true} = every weekday
WeekdaysOnly bool `protobuf:"varint,2,opt,name=weekdays_only,json=weekdaysOnly,proto3" json:"weekdays_only,omitempty"`
// start_date: Reference date for day_interval calculation.
// Day interval counts from this date.
// If not set, uses schedule creation date.
StartDate *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"`
// contains filtered or unexported fields
}
DailyRule schedules execution every N days.
Examples:
Every day:
{day_interval: 1}
Every other day:
{day_interval: 2}
Weekdays only:
{day_interval: 1, weekdays_only: true}
Every 3 days starting from specific date:
{day_interval: 3, start_date: "2024-01-01"}
func (*DailyRule) Descriptor
deprecated
func (*DailyRule) GetDayInterval ¶
func (*DailyRule) GetStartDate ¶
func (x *DailyRule) GetStartDate() *timestamppb.Timestamp
func (*DailyRule) GetWeekdaysOnly ¶
func (*DailyRule) ProtoMessage ¶
func (*DailyRule) ProtoMessage()
func (*DailyRule) ProtoReflect ¶
func (x *DailyRule) ProtoReflect() protoreflect.Message
type EasterOffset ¶
type EasterOffset struct {
// days_offset: Days to add to Easter Sunday.
// Negative = before Easter, positive = after Easter, 0 = Easter itself.
DaysOffset int32 `protobuf:"varint,1,opt,name=days_offset,json=daysOffset,proto3" json:"days_offset,omitempty"`
// contains filtered or unexported fields
}
EasterOffset represents holidays calculated relative to Easter Sunday. Easter date varies year-to-year based on lunar calendar.
Examples:
Good Friday: {days_offset: -2}
Easter Monday: {days_offset: 1}
Ascension Day: {days_offset: 39}
Pentecost: {days_offset: 49}
func (*EasterOffset) Descriptor
deprecated
func (*EasterOffset) Descriptor() ([]byte, []int)
Deprecated: Use EasterOffset.ProtoReflect.Descriptor instead.
func (*EasterOffset) GetDaysOffset ¶
func (x *EasterOffset) GetDaysOffset() int32
func (*EasterOffset) ProtoMessage ¶
func (*EasterOffset) ProtoMessage()
func (*EasterOffset) ProtoReflect ¶
func (x *EasterOffset) ProtoReflect() protoreflect.Message
func (*EasterOffset) Reset ¶
func (x *EasterOffset) Reset()
func (*EasterOffset) String ¶
func (x *EasterOffset) String() string
type FixedDate ¶
type FixedDate struct {
// month: Month (1=January, 12=December).
Month int32 `protobuf:"varint,1,opt,name=month,proto3" json:"month,omitempty"`
// day: Day of month (1-31).
Day int32 `protobuf:"varint,2,opt,name=day,proto3" json:"day,omitempty"`
// contains filtered or unexported fields
}
FixedDate represents a holiday on the same calendar date every year.
Examples:
Christmas: {month: 12, day: 25}
Independence Day (US): {month: 7, day: 4}
New Year's Day: {month: 1, day: 1}
func (*FixedDate) Descriptor
deprecated
func (*FixedDate) ProtoMessage ¶
func (*FixedDate) ProtoMessage()
func (*FixedDate) ProtoReflect ¶
func (x *FixedDate) ProtoReflect() protoreflect.Message
type Holiday ¶
type Holiday struct {
// name: Holiday name (e.g., "New Year's Day", "Memorial Day").
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// date: Specific date for one-time holidays.
// For recurring holidays, use rule instead.
Date *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=date,proto3" json:"date,omitempty"`
// recurring_yearly: If true, this holiday repeats every year.
// Requires rule to be set to determine the date each year.
RecurringYearly bool `protobuf:"varint,3,opt,name=recurring_yearly,json=recurringYearly,proto3" json:"recurring_yearly,omitempty"`
// rule: Logic for calculating holiday date.
// Required if recurring_yearly = true.
Rule *HolidayRule `protobuf:"bytes,4,opt,name=rule,proto3" json:"rule,omitempty"`
// contains filtered or unexported fields
}
Holiday represents a non-working day in a BusinessCalendar.
Examples:
Fixed date holiday (Christmas):
{
name: "Christmas",
recurring_yearly: true,
rule: {fixed: {month: 12, day: 25}}
}
Relative date holiday (US Thanksgiving - 4th Thursday of November):
{
name: "Thanksgiving",
recurring_yearly: true,
rule: {relative: {month: 11, weekday: 4, occurrence: 4}}
}
Easter-based holiday (Good Friday - 2 days before Easter):
{
name: "Good Friday",
recurring_yearly: true,
rule: {easter_offset: {days_offset: -2}}
}
func (*Holiday) Descriptor
deprecated
func (*Holiday) GetDate ¶
func (x *Holiday) GetDate() *timestamppb.Timestamp
func (*Holiday) GetRecurringYearly ¶
func (*Holiday) GetRule ¶
func (x *Holiday) GetRule() *HolidayRule
func (*Holiday) ProtoMessage ¶
func (*Holiday) ProtoMessage()
func (*Holiday) ProtoReflect ¶
func (x *Holiday) ProtoReflect() protoreflect.Message
type HolidayRule ¶
type HolidayRule struct {
// Choose one rule type based on holiday pattern.
//
// Types that are valid to be assigned to Rule:
//
// *HolidayRule_Fixed
// *HolidayRule_Relative
// *HolidayRule_EasterOffset
Rule isHolidayRule_Rule `protobuf_oneof:"rule"`
// contains filtered or unexported fields
}
HolidayRule defines how to calculate a holiday's date.
func (*HolidayRule) Descriptor
deprecated
func (*HolidayRule) Descriptor() ([]byte, []int)
Deprecated: Use HolidayRule.ProtoReflect.Descriptor instead.
func (*HolidayRule) GetEasterOffset ¶
func (x *HolidayRule) GetEasterOffset() *EasterOffset
func (*HolidayRule) GetFixed ¶
func (x *HolidayRule) GetFixed() *FixedDate
func (*HolidayRule) GetRelative ¶
func (x *HolidayRule) GetRelative() *RelativeDate
func (*HolidayRule) GetRule ¶
func (x *HolidayRule) GetRule() isHolidayRule_Rule
func (*HolidayRule) ProtoMessage ¶
func (*HolidayRule) ProtoMessage()
func (*HolidayRule) ProtoReflect ¶
func (x *HolidayRule) ProtoReflect() protoreflect.Message
func (*HolidayRule) Reset ¶
func (x *HolidayRule) Reset()
func (*HolidayRule) String ¶
func (x *HolidayRule) String() string
type HolidayRule_EasterOffset ¶
type HolidayRule_EasterOffset struct {
EasterOffset *EasterOffset `protobuf:"bytes,3,opt,name=easter_offset,json=easterOffset,proto3,oneof"` // Days offset from Easter
}
type HolidayRule_Fixed ¶
type HolidayRule_Fixed struct {
Fixed *FixedDate `protobuf:"bytes,1,opt,name=fixed,proto3,oneof"` // Same date every year (Dec 25)
}
type HolidayRule_Relative ¶
type HolidayRule_Relative struct {
Relative *RelativeDate `protobuf:"bytes,2,opt,name=relative,proto3,oneof"` // Relative to month (first Monday in May)
}
type MonthlyRule ¶
type MonthlyRule struct {
// day_type: How to interpret day_value.
DayType MonthlyRule_DayType `` /* 136-byte string literal not displayed */
// day_value: Day number or weekday.
// For DAY_OF_MONTH: 1-31 (values > month length skip that month)
// For WEEKDAY_OF_MONTH/LAST_WEEKDAY: 1=Monday through 7=Sunday (ISO 8601)
// For LAST_DAY: ignored
DayValue int32 `protobuf:"varint,2,opt,name=day_value,json=dayValue,proto3" json:"day_value,omitempty"`
// occurrence: Which occurrence of the weekday (for WEEKDAY_OF_MONTH).
// 1 = first occurrence, 2 = second, 3 = third, 4 = fourth
// 5 = fifth (rare, skips months without 5 occurrences)
// -1 = last occurrence (equivalent to LAST_WEEKDAY)
Occurrence int32 `protobuf:"varint,3,opt,name=occurrence,proto3" json:"occurrence,omitempty"`
// months: Which months to apply this rule (1=January, 12=December).
// Empty = all months.
// Common patterns:
//
// [3,6,9,12] = quarterly
// [1,4,7,10] = quarterly (different quarters)
// [1,7] = semi-annual
Months []int32 `protobuf:"varint,4,rep,packed,name=months,proto3" json:"months,omitempty"`
// contains filtered or unexported fields
}
MonthlyRule schedules execution on specific days of the month.
Examples:
15th of every month:
{day_type: DAY_OF_MONTH, day_value: 15}
First Monday of every month:
{day_type: WEEKDAY_OF_MONTH, day_value: 1, occurrence: 1}
Last Friday of every month:
{day_type: LAST_WEEKDAY, day_value: 5}
Last day of every month:
{day_type: LAST_DAY}
15th of March, June, September, December:
{day_type: DAY_OF_MONTH, day_value: 15, months: [3,6,9,12]}
func (*MonthlyRule) Descriptor
deprecated
func (*MonthlyRule) Descriptor() ([]byte, []int)
Deprecated: Use MonthlyRule.ProtoReflect.Descriptor instead.
func (*MonthlyRule) GetDayType ¶
func (x *MonthlyRule) GetDayType() MonthlyRule_DayType
func (*MonthlyRule) GetDayValue ¶
func (x *MonthlyRule) GetDayValue() int32
func (*MonthlyRule) GetMonths ¶
func (x *MonthlyRule) GetMonths() []int32
func (*MonthlyRule) GetOccurrence ¶
func (x *MonthlyRule) GetOccurrence() int32
func (*MonthlyRule) ProtoMessage ¶
func (*MonthlyRule) ProtoMessage()
func (*MonthlyRule) ProtoReflect ¶
func (x *MonthlyRule) ProtoReflect() protoreflect.Message
func (*MonthlyRule) Reset ¶
func (x *MonthlyRule) Reset()
func (*MonthlyRule) String ¶
func (x *MonthlyRule) String() string
type MonthlyRule_DayType ¶
type MonthlyRule_DayType int32
DayType determines how to select the day within a month.
const ( MonthlyRule_DAY_OF_MONTH MonthlyRule_DayType = 0 // Specific date (1-31) MonthlyRule_WEEKDAY_OF_MONTH MonthlyRule_DayType = 1 // Nth occurrence of weekday (first Monday, third Friday) MonthlyRule_LAST_WEEKDAY MonthlyRule_DayType = 2 // Last occurrence of weekday (last Friday) MonthlyRule_LAST_DAY MonthlyRule_DayType = 3 // Last day of month (handles varying month lengths) )
func (MonthlyRule_DayType) Descriptor ¶
func (MonthlyRule_DayType) Descriptor() protoreflect.EnumDescriptor
func (MonthlyRule_DayType) Enum ¶
func (x MonthlyRule_DayType) Enum() *MonthlyRule_DayType
func (MonthlyRule_DayType) EnumDescriptor
deprecated
func (MonthlyRule_DayType) EnumDescriptor() ([]byte, []int)
Deprecated: Use MonthlyRule_DayType.Descriptor instead.
func (MonthlyRule_DayType) Number ¶
func (x MonthlyRule_DayType) Number() protoreflect.EnumNumber
func (MonthlyRule_DayType) String ¶
func (x MonthlyRule_DayType) String() string
func (MonthlyRule_DayType) Type ¶
func (MonthlyRule_DayType) Type() protoreflect.EnumType
type RelativeDate ¶
type RelativeDate struct {
// month: Month (1=January, 12=December).
Month int32 `protobuf:"varint,1,opt,name=month,proto3" json:"month,omitempty"`
// weekday: Day of week (1=Monday, 7=Sunday, ISO 8601).
Weekday int32 `protobuf:"varint,2,opt,name=weekday,proto3" json:"weekday,omitempty"`
// occurrence: Which occurrence in the month.
// 1 = first, 2 = second, 3 = third, 4 = fourth
// -1 = last (useful when week count varies by month)
Occurrence int32 `protobuf:"varint,3,opt,name=occurrence,proto3" json:"occurrence,omitempty"`
// contains filtered or unexported fields
}
RelativeDate represents a holiday defined by weekday occurrence in a month.
Examples:
Memorial Day (US): Last Monday of May
{month: 5, weekday: 1, occurrence: -1}
Thanksgiving (US): 4th Thursday of November
{month: 11, weekday: 4, occurrence: 4}
Labor Day (US): First Monday of September
{month: 9, weekday: 1, occurrence: 1}
func (*RelativeDate) Descriptor
deprecated
func (*RelativeDate) Descriptor() ([]byte, []int)
Deprecated: Use RelativeDate.ProtoReflect.Descriptor instead.
func (*RelativeDate) GetMonth ¶
func (x *RelativeDate) GetMonth() int32
func (*RelativeDate) GetOccurrence ¶
func (x *RelativeDate) GetOccurrence() int32
func (*RelativeDate) GetWeekday ¶
func (x *RelativeDate) GetWeekday() int32
func (*RelativeDate) ProtoMessage ¶
func (*RelativeDate) ProtoMessage()
func (*RelativeDate) ProtoReflect ¶
func (x *RelativeDate) ProtoReflect() protoreflect.Message
func (*RelativeDate) Reset ¶
func (x *RelativeDate) Reset()
func (*RelativeDate) String ¶
func (x *RelativeDate) String() string
type Schedule ¶
type Schedule struct {
// schedule_id: Unique identifier for this schedule.
// Must be unique across all schedules in your ChronoQueue instance.
// Used for updating, pausing, resuming, or deleting the schedule.
// Recommended format: descriptive-name or {system}-{task}-{frequency}
ScheduleId string `protobuf:"bytes,1,opt,name=schedule_id,json=scheduleId,proto3" json:"schedule_id,omitempty"`
// metadata: Schedule configuration and execution state.
Metadata *Schedule_Metadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"`
// contains filtered or unexported fields
}
Schedule represents a recurring message posting pattern.
Use schedules to: - Execute tasks at regular intervals (every hour, daily, weekly) - Implement business calendar logic (weekdays, holidays, month-end) - Create complex scheduling rules (first Monday of month, quarterly reports) - Automate maintenance tasks, reports, notifications, batch jobs
Two scheduling modes: 1. Cron-based (legacy): Traditional Unix cron expressions 2. Calendar-based (recommended): Rich business calendar support
Example - Daily report at 9 AM weekdays:
schedule := &schedule.Schedule{
ScheduleId: "daily-sales-report",
Metadata: &schedule.Schedule_Metadata{
Payload: reportPayload,
QueueName: "report-generator",
CalendarSchedule: &schedule.CalendarSchedule{
Type: schedule.CalendarSchedule_BUSINESS_DAYS,
Rules: []*schedule.CalendarRule{{
BusinessDays: &schedule.BusinessDaysRule{...},
ExecutionTimes: []*schedule.TimeOfDay{{Hour: 9}},
}},
Timezone: "America/New_York",
},
Priority: 100,
MaxMessages: 1000, // Safety limit
},
}
Lifecycle: - SCHEDULED: Active, posting messages according to schedule - PAUSED: Temporarily disabled (can resume later) - CANCELED: Permanently stopped - ERRORED: Failed to execute (check state_message for details)
func (*Schedule) Descriptor
deprecated
func (*Schedule) GetMetadata ¶
func (x *Schedule) GetMetadata() *Schedule_Metadata
func (*Schedule) GetScheduleId ¶
func (*Schedule) ProtoMessage ¶
func (*Schedule) ProtoMessage()
func (*Schedule) ProtoReflect ¶
func (x *Schedule) ProtoReflect() protoreflect.Message
type ScheduleHistory ¶
type ScheduleHistory struct {
// messages: Messages created by this schedule.
// Limited to recent history (e.g., last 100 executions).
Messages []*v1.Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
// schedule_id: The schedule this history belongs to.
ScheduleId string `protobuf:"bytes,2,opt,name=schedule_id,json=scheduleId,proto3" json:"schedule_id,omitempty"`
// next_run: When the schedule will execute next.
NextRun *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=next_run,json=nextRun,proto3" json:"next_run,omitempty"`
// last_run: When the schedule last executed.
LastRun *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=last_run,json=lastRun,proto3" json:"last_run,omitempty"`
// created_at: When this schedule was created.
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
// updated_at: When this schedule was last modified.
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
// contains filtered or unexported fields
}
ScheduleHistory captures execution history and state for a schedule. Used by GetScheduleHistory API to show past executions and timing.
func (*ScheduleHistory) Descriptor
deprecated
func (*ScheduleHistory) Descriptor() ([]byte, []int)
Deprecated: Use ScheduleHistory.ProtoReflect.Descriptor instead.
func (*ScheduleHistory) GetCreatedAt ¶
func (x *ScheduleHistory) GetCreatedAt() *timestamppb.Timestamp
func (*ScheduleHistory) GetLastRun ¶
func (x *ScheduleHistory) GetLastRun() *timestamppb.Timestamp
func (*ScheduleHistory) GetMessages ¶
func (x *ScheduleHistory) GetMessages() []*v1.Message
func (*ScheduleHistory) GetNextRun ¶
func (x *ScheduleHistory) GetNextRun() *timestamppb.Timestamp
func (*ScheduleHistory) GetScheduleId ¶
func (x *ScheduleHistory) GetScheduleId() string
func (*ScheduleHistory) GetUpdatedAt ¶
func (x *ScheduleHistory) GetUpdatedAt() *timestamppb.Timestamp
func (*ScheduleHistory) ProtoMessage ¶
func (*ScheduleHistory) ProtoMessage()
func (*ScheduleHistory) ProtoReflect ¶
func (x *ScheduleHistory) ProtoReflect() protoreflect.Message
func (*ScheduleHistory) Reset ¶
func (x *ScheduleHistory) Reset()
func (*ScheduleHistory) String ¶
func (x *ScheduleHistory) String() string
type Schedule_Metadata ¶
type Schedule_Metadata struct {
// payload: Template payload for messages created by this schedule.
// Each scheduled execution creates a new message with this payload.
// You can include template variables that get resolved at execution time.
Payload *v11.Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
State Schedule_Metadata_State `protobuf:"varint,2,opt,name=state,proto3,enum=chronoqueue.api.schedule.v1.Schedule_Metadata_State" json:"state,omitempty"`
// schedule_config: Defines WHEN messages are posted.
// Choose one: cron_schedule (simple) or calendar_schedule (advanced).
//
// Types that are valid to be assigned to ScheduleConfig:
//
// *Schedule_Metadata_CronSchedule
// *Schedule_Metadata_CalendarSchedule
ScheduleConfig isSchedule_Metadata_ScheduleConfig `protobuf_oneof:"schedule_config"`
// queue_name: Target queue where scheduled messages are posted.
// Must be an existing queue or auto-created if allowed.
// Messages inherit queue's retry, lease, and DLQ settings.
QueueName string `protobuf:"bytes,4,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty"`
// message_ids: IDs of messages created by this schedule (for tracking/debugging).
// Auto-populated by ChronoQueue. Format: "{schedule_id}-{timestamp}"
// Use to correlate schedule executions with processed messages.
MessageIds []string `protobuf:"bytes,5,rep,name=message_ids,json=messageIds,proto3" json:"message_ids,omitempty"`
// next_run: When this schedule will execute next.
// Auto-calculated by ChronoQueue based on schedule_config.
// Read-only from client perspective.
NextRun *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=next_run,json=nextRun,proto3" json:"next_run,omitempty"`
// last_run: When this schedule last executed.
// Null if never executed. Useful for monitoring schedule health.
LastRun *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=last_run,json=lastRun,proto3" json:"last_run,omitempty"`
// created_at: When this schedule was created.
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
// updated_at: When this schedule was last modified.
// Updates when pausing, resuming, or changing configuration.
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
// exclusivity_key: Ensures only one instance of this schedule runs.
// Useful in multi-region deployments to prevent duplicate executions.
// Leave empty if multiple instances can run concurrently.
ExclusivityKey string `protobuf:"bytes,10,opt,name=exclusivity_key,json=exclusivityKey,proto3" json:"exclusivity_key,omitempty"`
// state_message: Human-readable status or error message.
// Contains error details when state = ERRORED.
// Example: "Failed to post message: queue 'reports' not found"
StateMessage string `protobuf:"bytes,11,opt,name=state_message,json=stateMessage,proto3" json:"state_message,omitempty"`
// priority: Priority for messages created by this schedule.
// Inherited by posted messages unless message specifies otherwise.
// Common values: 100 (high), 50 (normal), 10 (low).
Priority int64 `protobuf:"varint,12,opt,name=priority,proto3" json:"priority,omitempty"`
// has_max_messages: If true, enforces max_messages limit.
// Safety feature to prevent runaway schedules.
HasMaxMessages bool `protobuf:"varint,13,opt,name=has_max_messages,json=hasMaxMessages,proto3" json:"has_max_messages,omitempty"`
// max_messages: Maximum total messages this schedule can create.
// When reached, schedule automatically moves to PAUSED state.
// Reset by calling ResumeSchedule. Set to 0 for unlimited.
// Use for: one-time campaigns, limited batch jobs, testing.
MaxMessages int64 `protobuf:"varint,14,opt,name=max_messages,json=maxMessages,proto3" json:"max_messages,omitempty"`
// lease_duration: Override default lease duration for scheduled messages.
// If not set, uses queue's default lease_duration.
// Useful when scheduled tasks need different processing time than queue default.
LeaseDuration *durationpb.Duration `protobuf:"bytes,15,opt,name=lease_duration,json=leaseDuration,proto3" json:"lease_duration,omitempty"`
// timezone: Timezone for calendar_schedule calculations.
// IANA timezone format: "America/New_York", "Europe/London", "Asia/Tokyo"
// Affects when "9 AM" means and handles DST transitions correctly.
// Must be set when using calendar_schedule.
Timezone string `protobuf:"bytes,17,opt,name=timezone,proto3" json:"timezone,omitempty"`
// next_runs: Precomputed upcoming execution times (for preview/validation).
// Populated by PreviewSchedule API or ValidateSchedule API.
// Shows next N execution times to verify schedule behaves as expected.
NextRuns []*timestamppb.Timestamp `protobuf:"bytes,18,rep,name=next_runs,json=nextRuns,proto3" json:"next_runs,omitempty"`
// contains filtered or unexported fields
}
Metadata contains schedule configuration and execution state.
func (*Schedule_Metadata) Descriptor
deprecated
func (*Schedule_Metadata) Descriptor() ([]byte, []int)
Deprecated: Use Schedule_Metadata.ProtoReflect.Descriptor instead.
func (*Schedule_Metadata) GetCalendarSchedule ¶
func (x *Schedule_Metadata) GetCalendarSchedule() *CalendarSchedule
func (*Schedule_Metadata) GetCreatedAt ¶
func (x *Schedule_Metadata) GetCreatedAt() *timestamppb.Timestamp
func (*Schedule_Metadata) GetCronSchedule ¶
func (x *Schedule_Metadata) GetCronSchedule() string
func (*Schedule_Metadata) GetExclusivityKey ¶
func (x *Schedule_Metadata) GetExclusivityKey() string
func (*Schedule_Metadata) GetHasMaxMessages ¶
func (x *Schedule_Metadata) GetHasMaxMessages() bool
func (*Schedule_Metadata) GetLastRun ¶
func (x *Schedule_Metadata) GetLastRun() *timestamppb.Timestamp
func (*Schedule_Metadata) GetLeaseDuration ¶
func (x *Schedule_Metadata) GetLeaseDuration() *durationpb.Duration
func (*Schedule_Metadata) GetMaxMessages ¶
func (x *Schedule_Metadata) GetMaxMessages() int64
func (*Schedule_Metadata) GetMessageIds ¶
func (x *Schedule_Metadata) GetMessageIds() []string
func (*Schedule_Metadata) GetNextRun ¶
func (x *Schedule_Metadata) GetNextRun() *timestamppb.Timestamp
func (*Schedule_Metadata) GetNextRuns ¶
func (x *Schedule_Metadata) GetNextRuns() []*timestamppb.Timestamp
func (*Schedule_Metadata) GetPayload ¶
func (x *Schedule_Metadata) GetPayload() *v11.Payload
func (*Schedule_Metadata) GetPriority ¶
func (x *Schedule_Metadata) GetPriority() int64
func (*Schedule_Metadata) GetQueueName ¶
func (x *Schedule_Metadata) GetQueueName() string
func (*Schedule_Metadata) GetScheduleConfig ¶
func (x *Schedule_Metadata) GetScheduleConfig() isSchedule_Metadata_ScheduleConfig
func (*Schedule_Metadata) GetState ¶
func (x *Schedule_Metadata) GetState() Schedule_Metadata_State
func (*Schedule_Metadata) GetStateMessage ¶
func (x *Schedule_Metadata) GetStateMessage() string
func (*Schedule_Metadata) GetTimezone ¶
func (x *Schedule_Metadata) GetTimezone() string
func (*Schedule_Metadata) GetUpdatedAt ¶
func (x *Schedule_Metadata) GetUpdatedAt() *timestamppb.Timestamp
func (*Schedule_Metadata) ProtoMessage ¶
func (*Schedule_Metadata) ProtoMessage()
func (*Schedule_Metadata) ProtoReflect ¶
func (x *Schedule_Metadata) ProtoReflect() protoreflect.Message
func (*Schedule_Metadata) Reset ¶
func (x *Schedule_Metadata) Reset()
func (*Schedule_Metadata) String ¶
func (x *Schedule_Metadata) String() string
type Schedule_Metadata_CalendarSchedule ¶
type Schedule_Metadata_CalendarSchedule struct {
// calendar_schedule: Rich business calendar support (recommended).
// Supports:
// - Business days, holidays, custom calendars
// - Complex rules (nth weekday of month, last Friday, quarterly)
// - Timezone-aware scheduling
// - Exception handling (skip dates, reschedule)
// See CalendarSchedule message for full capabilities.
CalendarSchedule *CalendarSchedule `protobuf:"bytes,16,opt,name=calendar_schedule,json=calendarSchedule,proto3,oneof"`
}
type Schedule_Metadata_CronSchedule ¶
type Schedule_Metadata_CronSchedule struct {
// cron_schedule: Unix cron expression (legacy, still supported).
// Format: "minute hour day month weekday"
// Examples:
//
// "0 9 * * 1-5" = 9 AM weekdays
// "0 */4 * * *" = every 4 hours
// "0 0 1 * *" = first day of month
// "*/15 * * * *" = every 15 minutes
//
// Limitation: No timezone support, no business calendar logic.
CronSchedule string `protobuf:"bytes,3,opt,name=cron_schedule,json=cronSchedule,proto3,oneof"`
}
type Schedule_Metadata_State ¶
type Schedule_Metadata_State int32
State represents the schedule lifecycle stage.
const ( Schedule_Metadata_SCHEDULED Schedule_Metadata_State = 0 // Active, posting messages per schedule Schedule_Metadata_CANCELED Schedule_Metadata_State = 1 // Permanently stopped (terminal state) Schedule_Metadata_ERRORED Schedule_Metadata_State = 2 // Failed execution (check state_message for cause) Schedule_Metadata_PAUSED Schedule_Metadata_State = 3 // Temporarily disabled (can resume with ResumeSchedule) )
func (Schedule_Metadata_State) Descriptor ¶
func (Schedule_Metadata_State) Descriptor() protoreflect.EnumDescriptor
func (Schedule_Metadata_State) Enum ¶
func (x Schedule_Metadata_State) Enum() *Schedule_Metadata_State
func (Schedule_Metadata_State) EnumDescriptor
deprecated
func (Schedule_Metadata_State) EnumDescriptor() ([]byte, []int)
Deprecated: Use Schedule_Metadata_State.Descriptor instead.
func (Schedule_Metadata_State) Number ¶
func (x Schedule_Metadata_State) Number() protoreflect.EnumNumber
func (Schedule_Metadata_State) String ¶
func (x Schedule_Metadata_State) String() string
func (Schedule_Metadata_State) Type ¶
func (Schedule_Metadata_State) Type() protoreflect.EnumType
type TimeOfDay ¶
type TimeOfDay struct {
// hour: Hour of day (0-23), 24-hour format.
Hour int32 `protobuf:"varint,1,opt,name=hour,proto3" json:"hour,omitempty"`
// minute: Minute of hour (0-59). Default: 0
Minute int32 `protobuf:"varint,2,opt,name=minute,proto3" json:"minute,omitempty"`
// second: Second of minute (0-59). Default: 0
// Most schedules don't need second precision.
Second int32 `protobuf:"varint,3,opt,name=second,proto3" json:"second,omitempty"`
// contains filtered or unexported fields
}
TimeOfDay specifies a time within a day (wall clock time).
Examples:
9 AM: {hour: 9}
2:30 PM: {hour: 14, minute: 30}
Midnight: {hour: 0}
11:59:59 PM: {hour: 23, minute: 59, second: 59}
func (*TimeOfDay) Descriptor
deprecated
func (*TimeOfDay) ProtoMessage ¶
func (*TimeOfDay) ProtoMessage()
func (*TimeOfDay) ProtoReflect ¶
func (x *TimeOfDay) ProtoReflect() protoreflect.Message
type WeeklyRule ¶
type WeeklyRule struct {
// days_of_week: Which days of the week to execute.
// ISO 8601 format: 1=Monday, 2=Tuesday, ..., 7=Sunday
// Empty = all days (equivalent to daily schedule)
DaysOfWeek []int32 `protobuf:"varint,1,rep,packed,name=days_of_week,json=daysOfWeek,proto3" json:"days_of_week,omitempty"`
// week_interval: Execute every Nth week.
// 1 = every week, 2 = every other week (bi-weekly), 4 = monthly (every 4 weeks)
// Default: 1
WeekInterval int32 `protobuf:"varint,2,opt,name=week_interval,json=weekInterval,proto3" json:"week_interval,omitempty"`
// start_week: Reference date for week_interval calculation.
// Week interval counts from this date's week.
// Example: bi-weekly schedule starting Jan 1, 2024 executes on weeks of Jan 1, Jan 15, Jan 29, etc.
// If not set, uses schedule creation date.
StartWeek *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=start_week,json=startWeek,proto3" json:"start_week,omitempty"`
// contains filtered or unexported fields
}
WeeklyRule schedules execution on specific days of the week.
Examples:
Every Monday and Friday:
{days_of_week: [1, 5]}
Every weekday (Mon-Fri):
{days_of_week: [1, 2, 3, 4, 5]}
Every other week on Wednesday:
{days_of_week: [3], week_interval: 2, start_week: "2024-01-03"}
func (*WeeklyRule) Descriptor
deprecated
func (*WeeklyRule) Descriptor() ([]byte, []int)
Deprecated: Use WeeklyRule.ProtoReflect.Descriptor instead.
func (*WeeklyRule) GetDaysOfWeek ¶
func (x *WeeklyRule) GetDaysOfWeek() []int32
func (*WeeklyRule) GetStartWeek ¶
func (x *WeeklyRule) GetStartWeek() *timestamppb.Timestamp
func (*WeeklyRule) GetWeekInterval ¶
func (x *WeeklyRule) GetWeekInterval() int32
func (*WeeklyRule) ProtoMessage ¶
func (*WeeklyRule) ProtoMessage()
func (*WeeklyRule) ProtoReflect ¶
func (x *WeeklyRule) ProtoReflect() protoreflect.Message
func (*WeeklyRule) Reset ¶
func (x *WeeklyRule) Reset()
func (*WeeklyRule) String ¶
func (x *WeeklyRule) String() string
type YearlyRule ¶
type YearlyRule struct {
// month: Month of the year (1=January, 12=December).
Month int32 `protobuf:"varint,1,opt,name=month,proto3" json:"month,omitempty"`
// day: Day of the month (1-31).
// Must be valid for the specified month.
Day int32 `protobuf:"varint,2,opt,name=day,proto3" json:"day,omitempty"`
// adjust_for_leap_year: How to handle Feb 29 on non-leap years.
// If true: executes on Feb 28 on non-leap years
// If false: skips execution on non-leap years
AdjustForLeapYear bool `protobuf:"varint,3,opt,name=adjust_for_leap_year,json=adjustForLeapYear,proto3" json:"adjust_for_leap_year,omitempty"`
// contains filtered or unexported fields
}
YearlyRule schedules execution once per year on a specific date.
Examples:
January 1st (New Year's Day):
{month: 1, day: 1}
December 25th (Christmas):
{month: 12, day: 25}
February 29th (handles non-leap years):
{month: 2, day: 29, adjust_for_leap_year: true}
func (*YearlyRule) Descriptor
deprecated
func (*YearlyRule) Descriptor() ([]byte, []int)
Deprecated: Use YearlyRule.ProtoReflect.Descriptor instead.
func (*YearlyRule) GetAdjustForLeapYear ¶
func (x *YearlyRule) GetAdjustForLeapYear() bool
func (*YearlyRule) GetDay ¶
func (x *YearlyRule) GetDay() int32
func (*YearlyRule) GetMonth ¶
func (x *YearlyRule) GetMonth() int32
func (*YearlyRule) ProtoMessage ¶
func (*YearlyRule) ProtoMessage()
func (*YearlyRule) ProtoReflect ¶
func (x *YearlyRule) ProtoReflect() protoreflect.Message
func (*YearlyRule) Reset ¶
func (x *YearlyRule) Reset()
func (*YearlyRule) String ¶
func (x *YearlyRule) String() string