Task Writer

The following sample Task Writer passes a filter that would have gathered the item IDs to a query that will directly insert (insert select) into the database. Notice the parameter CHUNK_TASK_WRITE. The writer must check for this specifically but it is writing directly to the table rather than relying on the platform.

@Override
public Long writeTasks(JSONObject taskFilters) throws CoreIXMException {
InventoryPlanningTaskGenerator.populateTaskFilters(taskFilters);
if (modulePrefix != null && engineName != null && configName != null) {
JSONObject configParams = IXMEngineEnv.getInstance().getEngineConfigParams(modulePrefix, engineName, configName);
 
//expected additional IXM engine config parameters
if (configParams != null) {
if(configParams.has(ItemTaskWriterUtil.CHUNK_TASK_WRITE)) {
taskFilters.put(ItemTaskWriterUtil.CHUNK_TASK_WRITE, configParams.optBoolean(ItemTaskWriterUtil.CHUNK_TASK_WRITE));
}
}
}
ItemTaskWriterUtil taskWriter = new ItemTaskWriterUtil("IVP.TaskWriterSql", "GenerateTasksByItem");
taskWriter.writeTasks(taskFilters, modulePrefix + "_" + engineName + "_" + configName);
return taskWriter.getJobId();
}

POSSIBLE PROBLEM - Task Generator or Writer Spikes the App Server or Database

The logic in the Task Generator or Writer is limited to the one App Server and the Database. There is no possibility for horizontal or vertical scalability. If you have to create 400,000 tasks (1 per item and 400,000 items), then you have to have 1 App Server and the Database dedicated to inserting those records.