I'm looking at Activiti to control a hybrid of people-oriented processes and automated processes, and I'm trying to figure out some best practices.Is the general tendency to try to put automated processes somewhere controllable by web service, so that a ServiceTask combined with a Java class of some sort can call out to it?Is it frowned upon to have code controlling the automated process use the Activiti API directly? I mean, with the vacation example in the documentation, I could theoretically do this on a timer:
TaskService taskService = processEngine.getTaskService();
List<Task> tasks = taskService.createTaskQuery().taskCandidateGroup("management").list();
for (Task task : tasks)
{
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("vacationApproved", "true");
variables.put("managerMotivation", "The computer says so");
taskService.complete(task.getId(), variables);
}
Is that a no-no? Is there a nicer way to do the same sort of thing?Someone here floated the idea of launching/destroying VMs. It would seem that multiple VMs would be better handled by making the process on the VM responsible for asking for work instead of trying to register them somewhere and get a ServiceTask to specifically ask about them, but maybe that would be better?Excuse my newbishness in the area. It's entirely possible I saw the solution in front of my face as I was reading things but it didn't sink in Kind regards,– Ritchie Annand