Take a look at domain-specific work items. They are a special type of Task nodes that allow you model an invocation in the process as a custom node type and then register a handler, which is a simple Java class that can then invoke anything you like.
thank you very much for you reply. Well, according to the docs, I have created a work definition file and added in the META-INF folder of my project a rools.rulebase.conf which registers the workdefinition.
However the service task is not included in Eclipse palette so I cannot add it from the visual editor.
In the docs it is shown to appear in the Eclipse service task palette.
Has anybody managed to register a new work definition file successfully ?
thanks a lot
I've created a screencast about how to create your own node types a while ago. You could try following that to see whether that works or what you might be doing differently:
Note that this screencast uses a new Drools project to get started, but it also works if you create a new jBPM5 project (I just verified to be sure).
i tryed the screencast and everything works fine. Very importand is to put the
"customEditor" : "org.drools.eclipse.flow.editor.GenericModelEditor",
line in your definitions file, which is unfortunatelly hidden in the screencast.
Is there any way to integrate my new created WorkItemHandler with guvnor? If I use the integration jbpm-console - guvnor - eclipse with the last jbpm5-snapshot, then I do not start the jbpm-engine for selfe and have no idea how to get the StatefullKnowledgeSession -> WorkItemManager to register my created WorkItemHandler. Any Ideas?
I'm not sure to understand your question. I'm not a guvnor / jbpm console fan, but I think I can help you to solve the problem.
If you want to bind a workItemHandler to your knowledgeSession you can use the APIs: ksession.getWorkItemManager().register("name", handler);
My question was exacle how to get the "ksession" instance, if the jBPM engine was started by the jBPM console and is running in the web context.You are starting your jBPM process for selfe and so you have the full controll to the jBPM API. For me the jBPM engine is just the black-box, running and managed by the jBPM console.
Ok, now I understand your problem. So there are basically two options:
1) Expose the jBPM-Console created sessions, so you can interact with them using a remote APIs
2) Let the jBPM-Console use sessions that were created from outside applications, or add the posibility to register custom work item handlers to the sessions created by the jbpm-console.
About 1, there is a way to do that already using Drools Server. But we need to integrate it with the jBPM-console
About 2, I'm 90% sure that you can do it right now.. I've already seen some questions about that, but I don't remember the solution right now.. I probably will take a look on that..
Hope it helps, if you don't find the solution, please report a jira issue with your requirement as a feature request, we will evaluate it and work on it.
I have some questions regarding option 1) Expose the jBPM-Console created sessions, so you can interact with them using a remote APIs
How do you do that?
Here is my problem: We are using the jBPM-console to start processes. Our processes are using asynchronous behaviour on the service tasks (aka WorkItemHandler). The workItemHandler is simply sending a web service request to an external system. Later on, we receive a callback from the external system and we need to call kSession.signalEvent() in order to kick off the next step in the process.
We are controlling the web service interface so that the external system returns in the callback the workitemID that we sent as part of the original request, thus we know which processInstance to continue but the problem is that we also need the KnowledgeSession!
We could modify the web service interface and pass (and thus get returned) both the workitemID and the sessionID but I don't even know how to get hold of the jBPM-console internal sessionID from within a WorkItemHandler.
I can see that the Session started by the jBPM-console is persisted in the database (SESSIONINFO table in the H2 database) but I don't know how to get hold of it from within the WorkItemHandler.
We also start some of our processes using java code and they run within a separate session so we have more than one session running at the same time, so how to know which one a process started from the jBPM console is actually using?
Thanks in advance for the help!