Discussion:
[jboss-user] [jBPM] - Domain Service task default work item handler is not working if added through META-INF/*.wid file
vinayak Bhadage
2013-02-27 13:13:53 UTC
Permalink
vinayak Bhadage [https://community.jboss.org/people/vinayakpict] created the discussion

"Domain Service task default work item handler is not working if added through META-INF/*.wid file"

To view the discussion, visit: https://community.jboss.org/message/799865#799865

--------------------------------------------------------------
Hi ,

In JBPM5, I am using domain service task and also created work item handler for the same.
If at the time of creating knowledge session or before starting the process I have registered the custome work item handler in ksession.
then work item handler is executed perfectly.

Now from drool rule, want to start the process, in that case I have defined SAMPLE.wid file added in drools.rulebase.conf.
the wid file as below:

import org.drools.process.core.datatype.impl.type.StringDataType;

[
   [
    "name" : "SampleTask",
    "parameters" : [
              "name" : new StringDataType()
    ],
    "displayName" : "SampleTask",
    "icon" : "",
    "defaultHandler" : "com.sample.SampleTaskWorkItemHandler",
    "dependencies" : [
    ]
  ]
]


I this case work item handler is not found to ksession.

Please let me know that this approach will work.
Can jbpm5 process engine load the deafault handler mentioned in *.wid?

I have just started to learn about JBPM5. Please help me to resolve this issue.

Thanks & regards,
-vinayak
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799865#799865]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Yarr P.
2013-02-28 17:57:36 UTC
Permalink
Yarr P. [https://community.jboss.org/people/groopk] created the discussion

"Re: Domain Service task default work item handler is not working if added through META-INF/*.wid file"

To view the discussion, visit: https://community.jboss.org/message/800128#800128

--------------------------------------------------------------
Can't tell if this is exactly what you are after, but you can try it-

Shut down the server, then use 7-zip (or whatever tool you like) to open the jbpm-gwt-console-server.war\WEB-INF\classes\META-INF\CustomWorkItemhandlers.conf and add a line in like:

{code}
[
  "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
   "SampleTask" : new com.sample.SampleTaskWorkItemHandler()
]
{code}

Then jar up your SampleTaskWorkItemHandler class files and put them in the jbpm-gwt-console-server.war\WEB-INF\lib directory. Start up your server, then your SampleTask WorkItemHandler should be available to use without registering the handler from a ksession.

On a related note, I put in a jira to ask them to update their docs with this info, because it was not at all obvious how to do this. You can vote for it if you like: https://issues.jboss.org/browse/JBPM-3931 https://issues.jboss.org/browse/JBPM-3931
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/800128#800128]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
vinayak Bhadage
2013-03-01 06:09:26 UTC
Permalink
vinayak Bhadage [https://community.jboss.org/people/vinayakpict] created the discussion

"Re: Domain Service task default work item handler is not working if added through META-INF/*.wid file"

To view the discussion, visit: https://community.jboss.org/message/800201#800201

--------------------------------------------------------------
hi yarr,

Thanks for your reply.

I have tried it from the web application, have created to start the process. But still same thing is happened.
but I don't know who is parsing drools.session.conf and registering the work item handler.

How  can initialize knowledge session to read the configuration provided in drools.session.conf ?


In between I have tried to start the process from sample.drl file and registering the workitem handler and starting the process.

package com.sample.drl
 
import java.util.Map;
import java.util.HashMap;
import org.drools.runtime.process.ProcessInstance;
import com.sample.SampleTaskWorkItemHandler;
import com.sample.vo.EntityLifecycle;
 
rule "sample start  request"
 
    when
        $entity : EntityLifecycle( entityName == "Sample")
    then      
      SampleTaskWorkItemHandler sampleWorkItemHandler = new SampleTaskWorkItemHandler ();
       kcontext.getKnowledgeRuntime().getWorkItemManager().registerWorkItemHandler("SampleTask", sampleWorkItemHandler );
       
        Map params = new HashMap();
        params.put("entity", $entity);       
        ProcessInstance pi = kcontext.getKnowledgeRuntime().createProcessInstance("com.sampl.bpm.sampleRequest", params);
        insert(pi);
        kcontext.getKnowledgeRuntime().startProcessInstance(pi.getId());
end
 



Thanks & Regards,
-vinayak
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/800201#800201]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-03-01 13:28:24 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Domain Service task default work item handler is not working if added through META-INF/*.wid file"

To view the discussion, visit: https://community.jboss.org/message/800292#800292

--------------------------------------------------------------
please read the docs, especially http://docs.jboss.org/jbpm/v5.4/userguide/ch.console.html#d0e4698 this part that describes how to configure jbpm-console to use different settings than defaults. You'll see that registering work item handler is described there and you don't need to change configuration files inside the war files. Obviously you need to put your custom classes on jbpm-console classpath.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/800292#800292]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...