OverviewQBO 3 now has the ability to automatically re-queue items based on a user defined schedule. The schedule and it's attributes can be created "on the fly" by providing a text description of the schedule in the query string which is then parsed and is saved into the Schedule table with correct corresponding attributes. Query String SyntaxScheduling queued items can be accomplished using the following syntax in the query string: http://{sitename}/qbo3/{WebProject}/{WebHandler}.ashx/Schedule/{Operation}?Param.N.Name=Param.N.Value&ScheduleName=ScheduleText&ScheduleLabel=Optional Unique Label
For example: http://devmarket.quandis.com/qbo3/Market/MarketProduct.ashx/Schedule/Listen?Listeners=MarketProductInventoryChange&ScheduleName=Weekly on Mon, Wed repeating 5 hours between 5am to 10pm
Note: - The identifier "Schedule" must be provided between .ashx and the operation
- ScheduleName parameter used to set the behavior of the desired schedule. See below Schedule Name Syntax
- ScheduleLabel parameter (optional) is used to set a custom label for the schedule. This is necessary to create unique schedules when multiple items with same ClassName/Operation are scheduled on different schedules. See Advanced Examples below.
Schedule Name SyntaxSchedules can be categorized into 3 high level types: Daily, Weekly and Monthly. The following patterns are supported: Daily- Pattern: "Daily {specifying days} {set time|repeating|continuous}"
- Daily at a set time - "Daily {@|at} {HH:MM}{am|pm}"
- Daily using a time range - "Daily repeating {x} {minutes|hours} between {HH:MM}{am|pm} to {HH:MM}{am|pm}"
- Daily continuous using a time range - "Daily continuous between {HH:MM}{am|pm} to {HH:MM}{am|pm}
- Daily specifying days with a set time or repeating - "Daily every {x} days {set time|repeating}"
Weekly- Pattern: "Weekly {specifying weeks} on {Days} {set time|repeating}"
- Weekly on set days at a set time - "Weekly on {Days} {@|at} {HH:MM}{am|pm}"
- Weekly on set days with a time range - "Weekly on {Days} repeating {x} {minutes|hours} between {HH:MM}{am|pm} to {HH:MM}{am|pm}". A three day abbreviation for Days or the whole day can be specified
- Weekly specifying weeks with a set time or repeating - "Weekly every {x} weeks {set time|repeating}"
Monthly- Patterns:
- Monthly: "Monthly {specifying days} {specifying months} {set time|repeating}"
- Monthly Relative: "Monthly {specifying relative days} {specifying months} {set time|repeating}"
- Monthly specifying days at a set time - "Monthly on day {x} {@|at} {HH:MM}{am|pm}"
- Monthly specifying days with a time range - "Monthly on day {x} repeating {x} {minutes|hours} between {HH:MM}{am|pm} to {HH:MM}{am|pm}". A three day abbreviation for Days or the whole day can be specified
- Monthly specifying months and specifying days with a set time or repeating - "Monthly on day {x} every {y} months {set time|repeating}"
- Monthly relative specifying relative days with a set time or repeating - "Monthly on the {first|1st|second|2nd|third|3rd|fourth|4th|last} {Day} every {y} months {set time|repeating}"
- For all schedules, the predicate for "every {x} {days|weeks|months}" is optional and defaults to 1 if not specified
- All schedules can have a start and end date. If start date is not provided, it will default to DateTime.Now. End date defaults to null if not provided:
- Schedule Text can be tested at http://{sitename}/qbo3/Application/Schedule.ashx/Parse?Output=Xml&ScheduleName={Schedule Text}
- An existing ScheduleID can be passed as ScheduleText and the Parse method will attempt to locate based on Schedule.ScheduleID
Dynamic Schedule Lookup and MatchingBy specifying a schedule, the matching order of operations is: - Attempt to locate schedule where Schedule.Schedule = Schedule Name
- If not located, Parse schedule which produces a "normalized" description and attempt to locate based on Schedule.Description = Parsed Schedule.Description
- If not located, the schedule is saved with default labeling {ClassName} - {Operation} which can be overridden in {Object}.config SchedulePattern attribute on a case by case basis
Advanced ExamplesThere are scenarios when scheduled operations utilize the same ClassName/Operation and require a unique schedule name. As a result, any subsequent items scheduled for the same ClassName/Operation will bind to the first schedule established. For example: /Organization.ashx/Schedule/Listen?Listener=X &ScheduleName=Daily at 5:00am
/Organization.ashx/Schedule/Listen?Listener=Y &ScheduleName=Daily at 6:00am
Note the method signature (Schedule/Listen) is the same and the parameters make the call unique. The second call will bind to the first schedule based on dynamic schedule lookup. To schedule separate calls with unique schedules you can use the ScheduleLabel to ensure a unique schedule is created. To facilitate: /Organization.ashx/Listen?Listener=X&ScheduleName=Daily at 5:00am&ScheduleLabel=Organization Listener X Daily 5am
/Organization.ashx/Listen?Listener=Y &ScheduleName=Daily at 6:00am&ScheduleLabel=Organization Listener Y Daily 6am
By specifying a unique schedule label, this ensures unique schedules are established. |