JBoss Community

Re: Using TaskService directly

created by tlucz in jBPM - View the full discussion

I solved it. Instead of creation

 

taskSession = taskService.createSession();

 

in my own LocalHumanTaskHandler's constructor I needed instatiate LocalTaskService:

 

TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());

lts = new LocalTaskService(taskService);

 

then it is possible to register events:

 

private void registerTaskEventHandlers() {

        TaskEventKey key = new TaskEventKey(TaskCompletedEvent.class, -1);

        TaskCompletedHandler eventResponseHandler = new TaskCompletedHandler();

        lts.registerForEvent(key, false, eventResponseHandler);

        key = new TaskEventKey(TaskFailedEvent.class, -1);

        lts.registerForEvent(key, false, eventResponseHandler);

        key = new TaskEventKey(TaskSkippedEvent.class, -1);

        lts.registerForEvent(key, false, eventResponseHandler);

    }

 

Finally, my HT works correctly and can communicate with process instance.

 

 

kr,

Tadeusz

 

 

 

 


Reply to this message by going to Community

Start a new discussion in jBPM at Community