I did this in a project:
StatefulKnowledgeSession session = JPAKnowledgeService.newStatefulKnowledgeSession(gewKnowledgeBase(), null, getEnvoriment());
TaskServiceSession taskServiceSession = taskService.createSession();
org.jbpm.task.TaskService client = new LocalTaskService(taskServiceSession);
SyncWSHumanTaskHandler handler = new SyncWSHumanTaskHandler(client, session);
session.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
I did a library that modularize this, to handle close resources etc.
Hope it helps.
Thanks, but SyncWSHumanTaskHandler is what I want to replace
Try using this as you client:
obviously you need to create your taskService prior to that. and I believe that you should use LocalHTWorkItemHandler for local task service cases.
Sorry, my bad! I didn't mentioned that the local task service was previously created...
1. In the docs (13.2.2) says that "If you are using persistence, you should use CommandBasedWSHumanTaskHandler"
As I did not find the CommandBasedWSHumanTaskHandler, I thought that GenericCommandBasedWSHumanTaskHandler was the replacement
The GenericCommandBasedWSHumanTaskHandler accepts a TaskClient as a client (TaskClient implements AsyncTaskService) but the LocalTaskService implements TaskService. So it does not match
2. If I understand you, I should not use the GenericCommandBasedWSHumanTaskHandler but LocalHTWorkItemHandler instead?
I've got the LocalHTWorkItemHandler from the github, and I realize that I also need to reimplement the GenericHTWorkItemHandler. But GenericHTWorkItemHandler has 2 errors and I realize that I would have to reimplement the ContentMarshallerHelper and TaskService, should I do this? Or should I use the jbpm-human-task-core 5.4 Snapshot?
Alright, my bad too gave you details about master stuff. But it looks like you are on 5.3 Final level which is good as that should be more stable (at least in long run). So in that case look at GenericHTWorkItemHandler and put LocalTaskService as client and make sure you set local on that handler as well.
Regarding command based handler, that is correct it should be used with persistence and remote transports to human task server. As you intend to use local task service you will have it done as part of the engine transaction. Documentation was not updated yet to guide how to use these new handlers hopefully will be done soon.
In the meanwhile (before your previous post) I was using the human-task-core.5.4-Snapshot and the jbpm-flow.5.4-snapshot, both from yesterday build... and it was working with the LocalHTWorkItemHandler. But I don't think it's a good ideia to use some parts of 5.4-snapshot and others from 5.3-final.... so I reverted everything to 5.3-final and used the GenericHTWorkItemHandler. It works.
That's what I do:
.... LocalTaskService localTaskClient = new LocalTaskService(taskService); GenericHTWorkItemHandler handler = new GenericHTWorkItemHandler(kSession); handler.setClient(localTaskClient); handler.setLocal(true); handler.setIpAddress("127.0.0.1"); handler.setPort(9123); kSession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); handler.connect(); ....
Pedro: In this scenario how u are connecting the taskclient to the taskserver.? and operating the tasks start/complete functionality.?
I hope that u are using Mina as the taskserver. If possible kindly share the code snippet for taskclient connectivity.
I'm not using mina, I'm using everything local with spring integration.
And I use the start/complete of the localTaskService.
But I'm having some problems with complete functionality because I'm still don't know how to manage the kSession in spring...!
Still, if you think that I will have some code snippet that may help you, just ask
Thanks for your clarification.
Im looking for client connectivity in case of external task service HornetQ/Mina.
But in your implementation which service are u using as your taskserver.
I'm not sure to understand what's the main topic / problem here?
The question is already marked as answered, so if there is another problem we should create a separate thread and be focused on the thread title..
Mauricio: I just needed clarification.I thought in case of localtak service we dont need a taskserver but in code snippet ipaddress,port has been configured.
Im working with hornetq and thought some example would work for me.( https://community.jboss.org/message/745805#745805 )