Dynamic Scheduling of Queued Items

posted Jan 2, 2013, 5:22 PM by Greg Kent   [ updated Jul 24, 2013, 2:31 PM ]

Overview

QBO 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 Syntax

Scheduling 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

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 query string item must be provided

Schedule Name Syntax

Schedules 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}"
    • Eg. 'Daily @ 6am'
  • Daily using a time range - "Daily repeating {x} {minutes|hours} between {HH:MM}{am|pm} to {HH:MM}{am|pm}"
    • Eg. 'Daily repeating 5 minutes between 5am to 10pm'
  • Daily continuous using a time range - "Daily continuous between {HH:MM}{am|pm} to {HH:MM}{am|pm}
    • Eg. 'Daily continuous between 5am to 10pm'
  • Daily specifying days with a set time or repeating - "Daily every {x} days {set time|repeating}"
    • Eg. 'Daily every 3 day(s) repeating 5 minute(s) between 4:00a to 10:00p'

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}"
    • Eg. 'Weekly on Mon, Wed @ 12pm'
  • 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
    • Eg. 'Weekly on Mon, Wed, Fri repeating 3 hours between 5am to 11pm'
  • Weekly specifying weeks with a set time or repeating - "Weekly every {x} weeks {set time|repeating}"
    • Eg. 'Weekly on Mon, Wed, Sunday every 2 weeks repeating 5 minutes between 7am to 9pm

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}"
    • Eg. 'Monthly on day 1 @ 6:00a'
  • 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
    • Eg. 'Monthly on day 15 repeating 30 minutes between 5am to 10pm'
  • Monthly specifying months and specifying days with a set time or repeating - "Monthly on day {x} every {y} months {set time|repeating}"
    • Eg. 'Monthly on day 12 every 2 months repeating 2 hour between 5am to 10pm'
  • 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}"
    • Eg. 'Monthly on the 2nd Sun every 2 months repeating 2 hours between 5am to 10pm'

Additional Syntax Notes

  • 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:
    • Eg. 'Monthly on day 6 every 2 months repeating 2 hour between 5am to 10pm starting 1/1/2012 ending 2/1/2013'
  • 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 Matching

By specifying a schedule, the matching order of operations is:

  1. Attempt to locate schedule where Schedule.Schedule = Schedule Name
  2. If not located, Parse schedule which produces a "normalized" description and attempt to locate based on Schedule.Description = Parsed Schedule.Description
  3. If not located, the schedule is saved with default labeling {Table} - {Operation} which can be overridden in {Object}.config SchedulePattern attribute on a case by case basis
Comments