AnsweredAssumed Answered

Help creating/using a task listener

Question asked by arschloch1989 on Dec 20, 2011
Latest reply on May 21, 2012 by wuerg
I need help on creating and using a task listener for a user task.
I want to print out a meassage to tomcat/console saying at task: nameoftask, task assigne to: assignee, task completed, same over and over again for each task in the process until it's finished (i.e. a type of logging to keep track of what stage I'm at in the process)

for this task when I run it through the explorer it won't run and i get an errors saying couldn't istantiate class prototype_process.MakeRequestCreateTaskListener, and also class not found: prototype_process.MakeRequestCreateTaskListener

<userTask id="makeRequest" name="Make Request" activiti:assignee="${initiator}">
      Please fill out the form below, If you haven't ordered a phone before enter 1 in the years since last phone request field, You will have to re-enter the form with a value less than or equal to 5, if you enter a figure greater than 5 in the Years since last phone request field, as the scheme has a mandatory upgrade after 5 years
        <activiti:formProperty id="employeeName" name="Employee Name:" type="string" required="true"></activiti:formProperty> 
        <activiti:formProperty id="yearsSinceLastPhoneRequest" name="Years since last phone request:" type="long" required="true"></activiti:formProperty>
        <activiti:taskListener event="create" class="prototype_methods.MakeRequestCreateTaskListener" ></activiti:taskListener>

I currently have a task listener for one of my tasks, that should print out a line to the console/tomcat "currently at task 1", which I'm not sure is the correct way of doing it, I want to print out a String saying currently at Task 1, my task listener looks like this:

package prototype_methods;

import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

public class MakeRequestCreateTaskListener implements TaskListener {

   public void notify(DelegateTask delegateTask) {

       delegateTask.setDescription("currently at task 1");

and my code that runs/deploys the the process on to the process is:

package prototype_process;

import org.activiti.engine.ProcessEngine;

public class CompanyPhoneOrderProcess {

   public static void main(String[] args) {
      // Create Activiti process engine   
      ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration().buildProcessEngine();       
      // Get Activiti services   
      RepositoryService repositoryService = processEngine.getRepositoryService();
      // Deploy the process definition   

the task listener class is in a different package to the code that runs and deploys the process/bpmn20.xml file, when i put them in the same package no difference was made and still got he same errors

Any help would be greatly appreciated.