RSS

Category Archives: Drools

Getting Started with Drools Workbench and Execution Server

Nowadays with version 7.5.0.Final as its latest release, getting started with Drools Workbench and Drools Execution Server is easier than any time in its history.

Drools Workbench is the authoring and management user interface that Drools provides. This allows to create Drools projects, author rules, processes, models, etc, manage and deploy servers, etc.

Drools Execution server are servers that can have rules deployed, and being feed and executed from other applications.

How to install them?

Both applications have showcase images in docker, so, getting them is just a matter of pulling the images:

docker pull jboss/drools-workbench-showcase

docker pull jboss/kie-server-showcase

Once this is done, latest version of both are pulled.

To run them, first, you need to start the workbench:

docker run -p 8080:8080 -p 8001:8001 -d –name drools-workbench jboss/drools-workbench-showcase:latest

and then, run one instance of the execution server, pointing to the drools workbench image:

docker run -p 8180:8080 -d –name kie-server –link drools-workbench:kie_wb jboss/kie-server-showcase:latest

And, that’s it!

Workbench will be running in the following link:

http://localhost:8080/drools-wb/

And log in with user admin/admin

Screenshot from 2017-12-24 21-09-02.png

And the execution server, here:

http://localhost:8180/kie-server/services/rest/server/

With credentials kieserver/kieserver1!

For more information about these docker images, you can check the following links:

https://hub.docker.com/r/jboss/drools-workbench-showcase/

https://hub.docker.com/r/jboss/kie-server-showcase/

Next time, we will explain, how to get started on using drools workbench to do authoring, and then deploying and running it in the execution server.

Advertisement
 
Leave a comment

Posted by on December 25, 2017 in Drools

 

Tags: , , ,

Documents Module. Alpha

First advance on documents module for jBPM Console NG!

new ideas

Hello again!

I am here, writing again to show some of the progress I have been able to implement until now.

I have written the first integration with the CMS using CMIS protocol, using Apache Chemistry, for this integration. This will allow to change the CMS used for any that implements the CMIS protocol.

I have created a new module that is used in the console, which can be found here:

https://github.com/nicolasegomez/jbpm-console-documents

and also a fork of the jbpm console code

https://github.com/nicolasegomez/jbpm-console-ng

What I implemented until the moment is all the integration to CMIS, creating a facade service to consume it:

https://github.com/nicolasegomez/jbpm-console-documents/blob/master/jbpm-console-ng-documents-backend/src/main/java/org/jbpm/console/ng/documents/backend/server/CMISFacadeService.java

And also, the screens to consume and navigate the CMS tree, through the folders and download the content of the documents.

You can see how it is looking in this video:

I have work in progress for adding and removing documents, as well as editing its properties.

View original post 27 more words

 
Leave a comment

Posted by on June 22, 2014 in Drools

 

jBPM in GSOC 2014 again!

I am really happy to share that jBPM will be part of the Google Summer of Code 2014. My friend Nicolas will be implementing an extension to the Kie Workbench, to be integrated with an external CMS. In this case, a really nice and powerful, and open source CMS, called Magnolia.

This will be very helpful for jBPM users, and will enrich its integration capabilities a lot, so I hope to take a look how it will look like! I am sure it will end up being a really nice feature, mentored by salaboy, so it is a guarantee this will be a more than interesting feature.

Nicolas created its own blog, http://nicolasegomez.wordpress.com/ and he wil be sharing some of his progress there.

Thanks!

Demian

 
Leave a comment

Posted by on April 29, 2014 in Drools

 

Tags:

Drools Jboss Rules 5.X Developer’s Guide – Review

Hello world!
I had the chance of reading the book Drools Jboss Rules 5.X Developer’s Guide, written by Michal Bali, and I wanted to share my thoughts about this.
 Image
This book is intended to show various features of the Drools plattform to be able to succeed on writing rules and use and integrate them in real world applications.
First of all, this book covers all the major topics every person interested in using Drools must read. This effectively transmits the general ideas of when, why and how the use of Drools Plattform will help someone to implement his system, and also when and why NOT it would be helpful, in a clear and easy to understand vocabulary and organization.
The first thing I noticed from this book is the good amount of examples it provides. Examples are really instructive, different scenarios and examples are shown. These examples are all covered by showing the rules, processes, models and services they need, and they all have unit tests showing exactly how they run, which makes them even more helpful for the reader, and will make him save a lot of time!
The most important topics are discussed: Drools Rules, JBPM 5, Complex Event Procesing, with some theoric introductions and a lot of real world information. I personally liked the way jBPM examples are shown in the book, that gives a great idea of how powerful can be using jBPM and rules together in the way the Drools project proposes.
Details are well covered. From how to write simple rules, with the different configurations, syntax options and features, to writing a real application, going through most common implementation and design details a drools developer will have to deal with. Pay attention to Notes, there are always important tips mentioned!
Lastly, I could say as a detail, that I would have liked to read more about the different strategies for storing the rules. Using Drools Guvnor (or not), which are the options and design ideas to take into consideration and most common decisions that must be taken about this.
In conclusion this is a must-read for everyone interested in using Drools project, and it provides useful information for beginners, intermediate and also advanced users of drools. Really recommended book!
Thanks!
Demian
 
Leave a comment

Posted by on December 9, 2013 in Drools

 

Tags:

Drools and jBPM 6 Workshops @London

Hello World!

As many of you may know, the Drools team has been working hard for the 6 series of Drools and jBPM. They are comming with really nice new features that you can read in http://blog.athico.com/http://salaboy.com/ and related blogs. I will be taking about jBPM6 in this blog soon!

On October 23/24th, Mauricio Salatino (aka salaboy) and Michael Anstis will be talking about the new tooling and new stuff, in a free public session in London. The place will be sponsored by Plugtree, and it can be a nice opportunity to get in touch with first hand information on how it all looks like!

If you are wililng to attend, you can contact salaboy to reserve a sit. For more information, you can visit salaboy’s post about this.

http://salaboy.com/2013/10/04/drools-and-jbpm-6-workshops-2324-october-london/

Hope you can enjoy it!

Demian

 
Leave a comment

Posted by on October 4, 2013 in Drools

 

Tags: , ,

GSOC 2012

Hi everyone! I am back to my blog and hopefully I will write again soon!.

This time I will talk about my work in GSOC 2012.

The idea of my project is to allow human tasks to be flexible and configurable, and not simply hardcoded in an mvel file. So, it sound ideal to represent the human task life cycle as a business process.

Here I will talk about the possibilities I reviewed and in the next post I will come up with the finished solution.

Basically, there are two main options: The stateless and stateful option. The “less” or “full” refers to the possibility to save the task state into the process, or treat each state change as a single process instance. Let’s check the two possibilities.

Stateless Approach.

This approach only aims to have a process that captures events, make the desired checks and status changes in tasks and finished. This is not too much business process oriented, but has the flexibility for the user to change the behaviour of each Task Operation.

It could also be represented with a process per each operation, with a conditional event start, which would be a bit more ordered but with same limitations.

This is a test that shows this behavior:

https://github.com/calcacuervo/jbpm-human-task-gsoc-poc/blob/master/src/test/java/com/wordpress/demian/LifeCycleStatelessTest.java

The “Completed”, “Claimed”, “Started” (and will be more) nodes and some special nodes that has the configuration for each node behaviour. If you double-click one of then you will see something like this:

This has all the configuration that nowadays it is in OperationCommand class loaded by an mvel file.

With this approach, the StatefulKnowledgeSession used to run the process does not need to the persistent, as processes just starts and end each time.

Stateful Approach

In this approach, each process instance will represent all the task instance life. For this purposes, the process will look like this (obviously, with the other needed states too):

This seems a bit more real for the task life-cycle. But it required some more work in the coding part. Let’s see this test:

https://github.com/calcacuervo/jbpm-human-task-gsoc-poc/blob/master/src/test/java/com/wordpress/demian/LifeCycleStatefulTest.java

Each task has a StatefulKnowledgeSession associated. When it is put in the jbpm code, in some persisted place, the association between taskId – sessionId should be saved. When an operation for some task comes, the correcte StatefulKnowledgeSession will be loaded and the correct event will be signaled. It makes us think that this session has to be persistent, so we will have to take care about it.

What happens, for example if a now allowed user tries to do an Operation in a task? As the session is persisted and will run into a transaction, an exception in the operation node handler will be thrown (not allowed exception), and the transaction will be rolledback. But if for some security concern the application needs to save a non authorized attempt in some place, this handler could be hooked to override this behaviour.

And what does each Operation Node does? If you see this new human task refactoring approach:

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core-cdi

it has a hook to manage the task lifecycle, which is represented by the LifecycleManager interface:

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core-cdi/src/main/java/org/jbpm/task/internals/lifecycle/LifeCycleManager.java

The current implementation is an mvel based one:

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core-cdi/src/main/java/org/jbpm/task/internals/lifecycle/MVELLifeCycleManager.java

The idea with the process based approach will be to have a ProcessLifecycleManager, which will get the session for a task and signal the correct event. And the code that nowadays is in the MVELLifecycleManager that checks if user is allowed and changes the task status, potential owner and other task data will be put inside the Operation Node configured after each event.

I think this last approach will give enough flexibility for jBPM user to understand and change the human task behaviour, and even mixing it with business rules!

So, I will be integrating this approach with the “jbpm-human-task-core-cdi” and I will come back with news.

Thanks!

Demian

 
1 Comment

Posted by on August 2, 2012 in Drools

 

JBPM 5.1 in Tomcat 6

Hi everyone! I am back to the blog.
Recently I have done some work installing jbpm installer into tomcat again. It took me much less time that the first time :), but this time I decided to automate it, by patching the jbpm 5.1 full installer.First, let me review the steps I followed to deploy the jbpm installer tools in Tomcat 6:

1.
We need a JPA transaction manager to manage our jbpm runtime resources. So, let’s install Bitronix Transaction Manager in tomcat.
First, create btm-config.properties in tomcat.home/conf:
bitronix.tm.serverId=tomcat-btm-node0
bitronix.tm.journal.disk.logPart1Filename=${btm.root}/work/btm1.tlog
bitronix.tm.journal.disk.logPart2Filename=${btm.root}/work/btm2.tlog
bitronix.tm.resource.configuration=${btm.root}/conf/resources.properties

2.
Create resources.properties in tomcat.home/conf, which will have the resources that the transaction manager will manage.
resource.ds1.className=org.h2.jdbcx.JdbcDataSource
resource.ds1.uniqueName=jdbc/testDS1
resource.ds1.minPoolSize=0
resource.ds1.maxPoolSize=5
resource.ds1.driverProperties.URL=jdbc:h2:tcp://localhost/~/test
resource.ds1.driverProperties.user=sa
resource.ds1.driverProperties.password=
resource.ds1.allowLocalTransactions=true

3.
In tomcat.home/conf/context.xml, add this line

WEB-INF/web.xml
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" />

4.
In tomcat.conf/conf/server.xml, add this line

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener" />

5.
Create setenv.sh (or setenv.bat if using windows), with the following:
CATALINA_OPTS=”-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties”This file will be executed by catalina.shwhen starting tomcat

6.
Copy the following jars to tomcat.home/lib
btm-2.1.2.jar
btm-tomcat55-lifecycle-2.1.2.jar
dom4j.jar
ejb3-persistence.jar
h2.jar
javassist.jar
jta-1.1.jar
slf4j-api-1.6.0.jar
slf4j-jdk14-1.6.0.jar
You can take (apart from the two btm jars) the jars from the jboss as installation from the installer.

7.Explode gwt console server, and add a file called context.xml in META-INF/ with the following:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
 <!-- Default set of monitored resources -->
 <WatchedResource>WEB-INF/web.xml</WatchedResource>

<Resource name="jdbc/testDS1" auth="Container" type="javax.sql.DataSource"
 factory="bitronix.tm.resource.ResourceObjectFactory" uniqueName="jdbc/testDS1" />
</Context>

8.
Modify web.xml in gwt console server, adding the following:

<resource-env-ref>
 <resource-env-ref-name>jdbc/testDS1</resource-env-ref-name>
 <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
</resource-env-ref>

9.
Modify WEB-INF/classes/META-INF/persistence.xml in gwt console server to look like this:

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

<persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
 <provider>org.hibernate.ejb.HibernatePersistence</provider>
 <jta-data-source>java:comp/env/jdbc/testDS1</jta-data-source>
 <mapping-file>META-INF/JBPMorm.xml</mapping-file>
 <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
 <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
 <class>org.drools.persistence.info.SessionInfo</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>
 <properties>
 <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
 <property name="hibernate.max_fetch_depth" value="3"/>
 <property name="hibernate.hbm2ddl.auto" value="create" />
 <property name="hibernate.show_sql" value="false" />
 <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />
 </properties>
 </persistence-unit>

</persistence>

10.
Add the following jars (taken from jboss as lib) to WEB-INF/lib in gwt console server:
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate-entitymanager.jar

11.
Now, in exploded designer war, add the following jars (taken from jboss as lib) to WEB-INF/lib
antlr.jar
log4j-boot.jar

12.
Put the exploded wars in tomcat.home/webapps

13.
Start tomcat!
I have developed a patched version of installer to make it all for you:

https://rapidshare.com/files/3915421953/jbpm5.1.tomcat6.rar
Steps:

Hope this helps you!

Demian

PS: I will give 5.2 a try this week and update instructions if necessary!

 
3 Comments

Posted by on December 12, 2011 in Drools

 

Tags: , , , , ,

On Enter and On Exit Node actions in jBPM5

Hi Everyone, I am back to the blog!

Today I will try to show a quite new feature of jbpm5, which are On Enter and On Exit node actions. As its name indicates, these are actions which will be executed after or before the execution of a node. This is a quite frequently needed feature, that is not included in BPMN 2.0 specification, so now there is a way to include these actions.

There is an example of it in jBPM 5 github:

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/resources/BPMN2-OnEntryExitScriptProcess.bpmn2

Now I want to show something similar, but a more real situation were it was very helpful to use it for me.

In Emergency Services, we needed to make some processing on the result variables of a human task. It was not a trivial assignment that it could done (at least I did not see how) with the assignment expressions of the output mappings. Something like this should be done with the variables:

emergency.addUpdate(vehicle.getId(), new VehicleUpdate(comment, priority));

So we made it with an On Exit Node action. These actions are similar to script nodes, and we can get information about the process and also about the node from the kcontext.

We have a node

<userTask id="_12-2-4" name="Update Situation" >

Which has two data output variables,

<dataOutput id="_12-2-4_commentOutput" name="comment" />
<dataOutput id="_12-2-4_priorityOutput" name="priority" />

And also some input variables,

<dataInput id="_12-2-4_emergencyInput" name="emergency" />
<dataInput id="_12-2-4_vehicleInput" name="vehicle" />

Now, we added a On Exit Node action to make our desired processing,


<extensionElements>
 <tns:onExit-script scriptFormat="http://www.java.com/java">
 Emergency em = (Emergency)((WorkItemNodeInstance)kcontext.getNodeInstance()).getWorkItem().getParameter("emergency");
 Vehicle vehicle = (Vehicle)((WorkItemNodeInstance)kcontext.getNodeInstance()).getWorkItem().getParameter("vehicle");
 String comment = (String)((WorkItemNodeInstance)kcontext.getNodeInstance()).getWorkItem().getResult("comment");
 Integer priority = (Integer)((WorkItemNodeInstance)kcontext.getNodeInstance()).getWorkItem().getResult("priority");
 emergency.addUpdate(vehicle.getId(), new VehicleUpdate(comment, priority));
 </script>
 </tns:onExit-script>
 </extensionElements>

After the human task node is finished, this script will be executed. As you can see, in kcontext we have access to process, with kcontext.getProcessInstance(), process variables with kcontext.getVariable() and also to node instance and the work itam with kcontext.getNodeInstance().

The full bpmn can be found at https://github.com/Salaboy/emergency-service-drools-app/blob/V3/emergency-service-core/src/main/resources/processes/procedures/MultiInjuredEmergencyProcedure.bpmn.

You can also take a look at Emergency Services project source, where you will have lot of Jbpm and Drools examples. Hope this example helps you! Follow us @calcacuervo, @salaboy and @ilesteban.

Demian

 
Leave a comment

Posted by on September 3, 2011 in Drools

 

Tags:

Drools and jBPM5 Open Training @London – August 8th/9th

Hi everyone,

Plugtree is going to organize an open training session, that will focus in Drools Expert and jBPM5, and also covering Drools Fusion. It is open to everyone who wants to learn about these projects, no matter if you have previous experience using them or not, as will it cover these technologies essential concepts as well as best practices and project internals.

You can check esteban and salaboy posts for more details, and also the event registration page.

Enjoy!

Demian

 
Leave a comment

Posted by on July 18, 2011 in Drools

 

Tags: , , , , , , ,

Drools & Jbpm will be present in Argentina

As Mark announced in his post, the Drools Core Team will be present in Buenos Aires, Argentina, in a two days workshop in the middle of June. It is a great opportunity to actually from people who are actually implementing Drools/JBPM5, and has the whole picture and concepts about these technologies.

I will assist and will try to learn a lot, and I hope many people from Argentina and South America can also be there to have a great time!

See you there!

Demian

 
1 Comment

Posted by on May 25, 2011 in Drools, JBPM

 

Tags: