Querying for targets of a bulk insert work queue

You provide the query logic for the writer thread of a bulk insert work queue by overriding the abstract buildBulkInsertSelect method that your custom work queue class inherits from BulkInsertWorkQueueBase.

The following Gosu example code selects the units of work for a batch run, which are users with a status of On Vacation.

override function buildBulkInsertSelect(query : InsertSelectBuilder, args: List<Object>) {
  query.SourceQuery.compare(User#VacationStatus.PropertyInfo.Name, Relop.Equals, 
        VacationStatusType.TC_ONVACATION )
}

The following Gosu example code selects the units of work for a batch run, which are activities that no one has viewed in five days or more. Notice that this implementation of the method uses the extractSourceQuery method to generate the query result.

override function buildBulkInsertSelect(builder : Object, args: List<Object>) {
  extractSourceQuery(builder).compare( Activity#LastViewedDate.PropertyInfo.Name, Relop.LessThanOrEquals, 
        java.util.Date.Today.addBusinessDays(-5) )
}