Inception – The Anti Pattern – jBPM5 & Drools

It was a great year (2011), I have been doing consulting for all over the world about jBPM5 and Drools, visiting more than 15 different clients on different locations. All of them highly interested in learning and using these projects. But I notice, in at least 5 of them a weird new Anti Pattern which I call “Inception”. Most of the time they have a “Business” justification, but technically they all know that they are gonna have troubles at some point in the future. So, I decide to write a post with some thoughts around this anti-pattern for two main reasons:

  • It’s good to share when something around the projects, or how the people use the projects, is not right
  • I want to write a post before the end of the year with a special thanks section :)

Introduction

In all the jBPM5 & Drools Community training that I gave during this year, I took about an hour discussing about the classic integration between a BPM System and Rule Engines. The strongest point in my perspective is the fact that most of the BPM Systems out there do a very poor integration with a Rule Engine (by the way, most of them integrates with Drools). Most of them just use a Rule Engine for Decision Points inside the process or to do some Data Validation. Most of the time this interaction is completely stateless by nature and the inferences capabilities of the Rule Engine are not used at all.

This diagram represents this integration, very stateless, very poor …

Classic BPMS and BRE integration

This kind of integration, nowadays is a common integration pattern widely accepted and used. The BPMN 2.0 specification defines a Business Rule Task that can be used to model this interaction.

Business Rule Task

This node/activity can be used to interact with the Rule Engine (the specification mention that the interaction can be done via a web service), sending information and receiving a set of results from the evaluation.

The Problem

Obviously we can solve real life problems with the previously mentioned pattern, but the problem begins when I notice some “Inception” (ref1, ref2, ref3, ref4, … ) Anti Pattern being applied in practice.  So, what’s the real problem, let’s analyze the following figure:

But now we don't have just a Rule Engine

Hmm.. it looks OK!, the integration seems right.. The problem starts when a Smart Developer, having smart developers usually cause troubles :), notice that if they are using Drools 5 as a Rule Engine, they get jBPM5 for free and they can start running processes inside the Business Logic Integration Platform. So.. They start to wonder.. why do I need my original BPM System, if I have jBPM5 fully integrated with Drools and I can avoid moving data all around, calling slow web services that needs to marshal complex structures into XML each time that I want to interact? This is a very long question, but a very valid one :)

If we don’t control this situation when it start, sooner or later we will find ourselves into the INCEPTION ANTI-PATTERN!!!!!

YO DAWG...

YO DAWG, I NOTICE THAT YOU LIKE PROCESS ENGINES, SO I’VE INCLUDED A PROCESS ENGINE INSIDE THE RULE ENGINE, SO WHEN YOU CALL THE RULE ENGINE FROM YOUR OLD PROCESS ENGINE YOU CAN START PROCESS INSIDE THE RULE ENGINE :)

Inception Number 1

A Business Process talking with a Rule Engine that start another Business Process but not in the same BPMS??? So, now the question is: if I already integrate or if I’m planning to integrate my application with a Rule Engine(specially Drools 5) and I already have another BPM System (different than jBPM5), what should I do?

Some Thoughts

If you notice that you are running in a situation like the one previously described, I suggest you to analyze your architecture once again before making any decision. If your company wants to leverage the power of a Rule Engine like Drools 5, they need to understand the context and all the other features that it provides now. Once again, Drools 5 its not just a Rule Engine.

In large companies, they can’t drop their old Process Engine. Most of the time they have paid a lot of money for it and they need to justify that investment. So, sooner or later, you will find this pattern.

Inception 2 - Keeping the old BPMS

Large companies tends to out source projects that use the BPMS as backbone to plugin and coordinate different components. If one or multiple companies are in charge of designing these business processes and interacting with the Rule Engine, they will start to avoid unnecessary communications to create high performance components and business processes. The Inception 2 – figure- shows how the company decide to move their process to the Drools BLiP and handle the logic and the orchestration of activities inside the Drools 5 runtime. Instead of defining a business process that interact in an stateless way with the Rule Engine. I’m not agree with keeping the old Process Engine, but there are sometime when that decision is more political than technical. The advantages of this approach are obvious. Now the processes and the rules are working together to achieve a business goal, in the same stateful context, sharing the same information.

I will not go over all the advantages of these approach, I will leave that for the jBPM Developer Book, but I want to mention that the fact that I start noticing this recurrent situation in different companies from different industries and different countries, is that people is realizing the power of the BLiP Platform. Developers are starting to understand how they can model and solve more complex scenarios using the synergy of all these approaches together.

So, what you should do? Learn, read and join the community of these amazing projects. Most of the times, when you are using a BPM System, someone in your team will introduce a Rule Engine. If you are working in Java there are high chances that the Rule Engine will be Drools, so take your time and know by hand that your smart developers will want to take advantage of all the features inside the platform and not just the 5% that represent stateless evaluations.

To wrap up this post, because it’s getting late and the new year is coming, I would like to mention a very similar scenario that I didn’t see yet, but I’m pretty sure that it will start to appear.

Similary to BPM, and in conjunction with BPM (see the 2012 BPM prediction -> http://blogs.forrester.com/derek_miers/11-12-31-a_bpm_prediction_for_2012_connecting_the_dots)  Complex Event Processing (CEP) is another hot topic.

Once again, how we integrate the Process Engine with the Processing Agents provided by the CEP component? We will need to waste time learning about these three components :(

Integration with CEP

Don’t worry! We are almost in 2012! Once again the BLiP platform remove the EVIL RED LINES :)

CEP + BPMS + Rule Engine

Thank You, Thank You and Thank You!

I really want to thank you for the support during this last year! I want to thank you for posting a comment here or for giving feedback about the content of this blog! I’ve reached 100K visits during 2011, and that means that Drools & jBPM5 are getting better and better! I hope to be able to double that number on 2012!

I wish you all Happy New Year and I promise you that I will stay active in the community! Stay tuned because 2012 will be a great year for these projects and all the community around them!

Salaboy – 2011

About these ads
Tagged , , , , , , , , , , , , , , , , , , , , , , ,

16 thoughts on “Inception – The Anti Pattern – jBPM5 & Drools

  1. Pratik says:

    Please make your website in another domain. WordPress is little harassing and often don’t show the images.

    • salaboy says:

      Hi Patrik,
      This is the first time that someone tell me that WordPress is not working right.. I mean.. is a well hosted server, can you please report me the images that are not being displayed correctly? probably is because I’m pointing to a different site and that site is down. Do you have another host suggestion? I’m open to contributions for replicating this blog in somewhere else.
      Cheers

  2. Thorsten says:

    I like the BPMN diagrams. With which tool did you create them?

  3. Gab says:

    “Most of them just use a Rule Engine for Decision Points inside the process or to do some Data Validation”.

    Let’s just think about the real need of using rules = inner recursive mechanism with auto-propagation of changes.

    In a real system, first issue for extensive usage of rules would be regarding the performance of Drools for anything else but simple data validation, as rules would need to be applied to multiple facts which usually hold several thousands or hundred thousand items (partners, contracts, deals, etc).

    Which, in terms of performance and memory load, is currently a no-go situation.

    • salaboy says:

      I think that’s another misconception about rule engines that comes from the ages where you move the information that you were using inside your business process to your rule engine, and Complex structures with big trees needs to be loaded in memory. Nowadays having tons of RAM allows us to do that much more efficiently. The idea doing complex inference on top of that data that you have and taking advantage of a platform that give you that for free and out of the box is unlimited. I have still in draft an article about what we can do with the rule engine in conjunction with business processes, and the article starts using a similar phrase: “if we just do “simple data validation” with the rule engine we are using only 1% of its power”.
      So, Gabriel, thanks for your comment and stay tuned, because I have a personal commitment to break those misconceptions and provide practical examples about how you can use this amazing platform that we are building :)
      Cheers

    • salaboy says:

      This comments really reminds me to the era were people says that Hibernate will never work because it uses to much memory and it takes too much time to create objects from the database. Nowadays with the rise of NoSQL databases (which in fact loads GBs of data in memory) we need to rethink and understand new patterns about how to handle data.
      Cheers

  4. Gab says:

    Agree.
    Which NoSQL DBMS have you been successfully using in conjunction with Drools?

    • salaboy says:

      Check the following presentation about Drools and Large amounts of data: http://vimeo.com/27209589 this is one of the possible solution, but it really depends on what are you trying to do. Check at my vimeo user for more presentations about Drools and different scenario. All the same things applies to Business Process in jBPM5.
      Can I ask what’s your use case? or what kind of performance tests have you being doing in order to affirm “Which, in terms of performance and memory load, is currently a no-go situation”? Doing consulting I found out that most of the time the problems can be solved using a different angle which is difficult to see when you don’t understand how to leverage the power of the rule engine, or when you want to use a rule engine to do something that you can do using imperative code.
      Cheers

    • salaboy says:

      Check the following presentation about Drools and Large amounts of data: http://vimeo.com/27209589 this is one of the possible solution, but it really depends on what are you trying to do. Check at my vimeo user for more presentations about Drools and different scenarios. All the same things applies to Business Process in jBPM5.
      Can I ask what’s your use case? or what kind of performance tests have you being doing in order to affirm “Which, in terms of performance and memory load, is currently a no-go situation”? Doing consulting I found out that most of the time the problems can be solved using a different angle which is difficult to see when you don’t understand how to leverage the power of the rule engine, or when you want to use a rule engine to do something that you can do using imperative code.
      Cheers

  5. Gab says:

    My case regards a shift&workload allocation algorithm for ~90000 tx / day.

    Ok, checked the material, checked the web, sites, books – i need your help on how to connect drools to nosql. The way i see it, you are redirecting only fact queries to nosql, so drools code itself needs to be re-written.

    • Gab says:

      I’ve seen this on page 14 , at http://www.slideshare.net/jbugrome/drools-introduction
      is this part of the answer?

      • Gab says:

        sorry for multiple posts – by above “this” i meant “Person()from$hbn.getNamedQuery(“FindPeople”)” – $hbn being an Hibernate session – meaning that it could also be an Hibernate OGM Session ?

      • salaboy says:

        No that’s just a poor way of accessing external data from the engine.. is not a solution.
        There is no just one way to connect them both. The good thing about in memory no sql databases is that they already have the objects in memory, so you don’t have the performance impact of loading them from the database and converting them into objects. What kind of inferences do you need to do over each of those 90000 tx / day? Can they be analyzed alone or in groups? how can you partition your data?
        You need to answer those questions in order to build your design.. I cannot build it for you :)
        Cheers

  6. Gab says:

    What would a “good” way of loading large data into DROOLS using NOSQL databases be?

    • salaboy says:

      There is no answer to that question, because it depends on the NoSQL db that you are using, how your model looks like and what are you main goals to achieve. Do you know that there are different types of NoSQL dbs right? each of them was designed with a very different purpose, so it really depends on what you have and how your data can be partitioned.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 880 other followers

%d bloggers like this: