OddJob Quick Reference
Service for running large batch processing tasks in manageable chunks over multiple cycles
Key Features
- Process large lists in chunks to avoid timeouts
- Resume processing across server restarts
- Monitor progress in real-time
- Queue-based task processing
- Configurable chunk size and timing
- Server-side JavaScript processing
Server-Side Usage:
// Create an OddJob processor (TestOddJob.sjs example)
var processor = {
init: function(config) {
// Initialize processor
return true;
},
processItem: function(item, context) {
// Process single item from list
console.log("Processing: " item);
return {success: true, message: "Processed " item};
},
complete: function(context) {
// Called when all items processed
console.log("OddJob complete");
}
};
// Configuration file (odd-job.config.json)
{
"processor": "/OpenForum/AddOn/OddJob/TestOddJob.sjs",
"chunkSize": 10,
"delayBetweenChunks": 1000,
"list": {
"pageName": "/OpenForum/AddOn/OddJob",
"fileName": "my-list.json"
}
}
Client-Side Usage:
// Start OddJob
JSON.post('/OpenForum/AddOn/OddJob/Start', null,
'pageName=/MyPage&configFile=odd-job.config.json')
.onSuccess(function(result) {
console.log('OddJob started');
}).go();
// Stop OddJob
JSON.post('/OpenForum/AddOn/OddJob/Stop')
.onSuccess(function(result) {
console.log('OddJob stopped');
}).go();
// Get status
JSON.get('/OpenForum/AddOn/OddJob/Status')
.onSuccess(function(status) {
console.log('Progress:', status);
}).go();
Configuration
- Define processor script location
- Set chunk size (items per cycle)
- Configure delay between chunks (milliseconds)
- Specify list file location
- List format: JSON array of items to process