Friday, May 6, 2011

jBPM 5 Tips

From jBoss advertisement (http://www.jboss.org/jbpm/components/core-engine.html):

- From a spring based web application for a grocery store on Tomcat over a top scale banking application to a plain standalone Java application.
- The jBPM engine can be used as a remote service.
- Simple API
- Human tasks
- Integrated with rules engine
- Transactional execution, timers and asynchronous continuations

Reality:

0. jBPM & Drools source code & documentation quality


- no comments in source code
- no Java API with any comments. (What do fireAllRuless() function while I start BPMN2 process?).

jBPM only:
- no developer documentation
- no typical deployment configurations (only Tomcal+hibernate. No typical GlassFish or JBoss configurations).
- no examples. Test cases only. Developer need read Drools documentation & source code for BPMN programming!
- absolutly unusefull API for Business Process Management. jBPM 5.0 have only API for Rules in simple drools-flow session, but it is nontrivial task to find active tasks for user "myuser" avtivity.
- no usefull remote API. Remote application can set tast "completed" or "aborted" but it cannot find tasks for execution! It must already now the Task ID for set it "completed", but without search! JBoss group said it is "Simple API" and "The jBPM engine can be used as a remote service." :)
- now any user authorithation internally (in source code)
- TCP port for MinaTaskServer "Human Task" without any authorithation. JBoss group said it is "top scale banking application" - ready :) Banks are welcome:)
- The community of previous versions of jBPM migrated from JBoss to Activiti fork project.

Guvner only:
- No any way to integrate with Subversion or other version control or build system for developers.


1. Experimental & unstable dependencies in "stable" releases.

jBPM 5.0 FINAL is based on Drool Flow and include drools, drools-flow 5.2.0.M1 (Milestome 1) library, with unfixed database bugs, etc. It is Drools/jBPM practice. It is fact.


2. Do you want to use JPA persistence?
- You need add persistence.xml + orm.cml to META-INF folder.
- You need catch exception ProcessInstancesWaitingForEvent, then use google, then find ProcessInstancesWaitingForEvent named query in GWT (http://community.jboss.org/thread/162854), then manually add ProcessInstancesWaitingForEvent named query to orm.xml.


ProcessInstancesWaitingForEvent named query:

<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
    processInstanceInfo.processInstanceId
from
    ProcessInstanceInfo processInstanceInfo
where
    :type in elements(processInstanceInfo.eventTypes)
</query>
</named-query>


jBPM 5.0 Final user documentation said, for persistance:

StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, env);

It is not work with JPA, of course.
In reality (work example from jBPM JUnit test):

Properties properties = new Properties();
properties.put("drools.processInstanceManagerFactory","org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
properties.put("drools.processSignalManagerFactory","org.jbpm.persistence.processinstance.JPASignalManagerFactory");
KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);

StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, config, env);



- For PostgreSQL, after Hibernate create database structure, developer must run database modification script to fix metadata bug:


ALTER TABLE sessioninfo DROP COLUMN rulesbytearray;
ALTER TABLE sessioninfo ADD COLUMN rulesbytearray bytea;


ALTER TABLE workiteminfo DROP COLUMN workitembytearray;
ALTER TABLE workiteminfo ADD COLUMN workitembytearray bytea;


There is same bug in processinstanceinfo table - processinstancebytearray column, but ORM mapping do not allow fix it by simple database modification.

So, yes! It is 5.0 FINAL version! :)

3. Do you want to use JBoss JPA?

- Use this persistence.xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
             version="1.0">


   <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/jdbc/jbpmDS</jta-data-source>


    <class>org.drools.persistence.info.SessionInfo</class>
    <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
    <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
    <class>org.drools.persistence.info.WorkItemInfo</class>
    <class>org.jbpm.process.audit.ProcessInstanceLog</class>
    <class>org.jbpm.process.audit.NodeInstanceLog</class>
    <class>org.jbpm.process.audit.VariableInstanceLog</class>
   
    <class>org.jbpm.task.Attachment</class>
    <class>org.jbpm.task.Content</class>
    <class>org.jbpm.task.BooleanExpression</class>
    <class>org.jbpm.task.Comment</class>
    <class>org.jbpm.task.Deadline</class>
    <class>org.jbpm.task.Delegation</class>
    <class>org.jbpm.task.Escalation</class>
    <class>org.jbpm.task.Group</class>
    <class>org.jbpm.task.I18NText</class>
    <class>org.jbpm.task.Notification</class>
    <class>org.jbpm.task.EmailNotification</class>
    <class>org.jbpm.task.EmailNotificationHeader</class>
    <class>org.jbpm.task.PeopleAssignments</class>
    <class>org.jbpm.task.Reassignment</class>
    <class>org.jbpm.task.Status</class>
    <class>org.jbpm.task.SubTasksStrategy</class>
    <class>org.jbpm.task.Task</class>
    <class>org.jbpm.task.TaskData</class>
    <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
    <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
    <class>org.jbpm.task.User</class>


      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.hbm2ddl.auto" value="update"/>
         <property name="hibernate.jdbc.batch_size" value="20"/>
         <property name="hibernate.default_schema" value="public"/>
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
      </properties>
   </persistence-unit>
</persistence>




Still you want to use jBPM and DRools now?

3 comments:

  1. Innovation is not free, and the good thing is that the project is getting better and better. I'm not a marketing guy (just a community developer that works for free in this projects), but jBPM5+ Drools is the only open source project that provides the integration between Processes, Rules and Complex Event Processing. If you want just to use a BPMS you can choose the one that you like most. I can go through all the points that you mention to clarify the status and why some changes needs to be made (besides the bugs and lack of documentation) but I don't think that is needed I you don't have experience using Rule Engines or Complex Event Processing features. And by the way, it's easy to say that the community project doesn't have documentation, but it's also easy to contribute and help the community to make better projects.

    Cheers

    ReplyDelete
  2. >> "jBPM5+ Drools is the only open source project that provides the integration between Processes, Rules and Complex Event Processing."


    - I agree that any technological innovation and software evolution is hard way. Yes, Drools Rule Engine release good thinks and is highly targeted and worldwide used project. Yes, Open Source code is not free.

    Otherwise, jBPM 5.0 "FINAL" release publication with alpha-like quality is very bad practice. It is not developers or community mistake, it is project management ... fraud, I think. It is lie to project users.

    Ok, the project grow and no up-to-date documentation. But why project source code is not commented? It is not Ok, it is a project with bad practices.

    I choose Bonita as "ready for enterprise using" BPMS and my company do not use jBPM and Drools now.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete