Eric D. Schabell: November 2013

Friday, November 29, 2013

Open Source Conference Amsterdam 2013 - JBoss Integration & BPM in the house

Previously I mentioned that I will be speaking at the Open Source Conference 2013 in Amsterdam, hosted by Red Hat in the Amsterdam Beurs van Berlage (the old stock exchange building) on the 6th of December.

Traditionally this event draws a great crowd, over 1000 attendees the last few years, registration is completely free so sign up now!

They have scaled back on my original planned two session, so I will only be talking about what is new in Integration & BPM, but look forward to seeing you there.

What’s new in JBoss Integration & BPM World

(Breakout Room 3, 14:55 - 15:25 hrs)

Join us for a session on the coming product launches of Red Hat JBoss Fuse Service Works (FSW), Red Hat JBoss Business Rules Management System (BRMS), and Red Hat JBoss Business Process Management Suite (BPM Suite). We will walk you through these exciting new technologies, what they are going to mean to you, and how they can be leveraged to expand your business into the future.

JBoss FSW is Red Hat’s middleware solution for application integration, messaging, SOA, and service governance requirements. It combines the core ESB technology from our Fuse product and technical innovations from popular open source communities like SwitchYard and Overlord. JBoss BRMS and BPM Suite are Red Hat’s next generation products for maximizing your business activities with rules, events, reporting, and processes by leveraging the popular open source communities Drools and jBPM.

Thursday, November 28, 2013

Migration Tips - moving projects from JBoss BRMS 5 to JBoss BPM Suite 6

Getting ready for your migration?

This migration article will try to put into perspective the daunting task that any developer faces when asked to evaluate the move from one version of a product to another.

Introduction

We will try to put the aspects that need your attention, allowing you to evaluate your personal project for migration to the new Red Hat JBoss BPM Suite v6.

It should be understood that the JBoss BPM Suite 6 product represents a superset of the JBoss BRMS 6 product. Therefore, by covering the BPM example project we will automatically cover rule project assets as we go along.

For the rest of this article we will be using an existing JBoss BRMS 5 project that we migrated to JBoss BPM Suite 6, providing the links to the projects code base both before and after the migration:
Please read the projects files for links to other articles describing requirements, products, and how to both install and run these demos in their respective IDE or product UI components. Also note the first demo project is more maturely documented at this time, the newer version will be expanding over time so check back regularly or feel free to submit any changes you feel could be of use.

Foundations

The backbone of the new JBoss BRMS & BPM Suite 6 products is based on using GIT as the repository for all your rule and process assets. Where as the older JBoss BRMS 5 product used a JCR repository based on Jackrabbit, we now seem to have the ability to migrate our projects into the new product with a single push of our project into a new repository.

Or is it not that simple?

Unfortunately it is not that easy. First you need to understand that the git backend is usable by all tools that support it. For example, the git CLI tooling you can use from your favorite shell work 100% with this repository. What is important to understand is that the current UI provided by the JBoss BRMS & BPM Suite products are not full git implementations. They currently interact in a very simplified way and when unable to interact will often just present an empty repository view.

To get the current product working correctly depends on adhering to the needed structure of your git repository. To ensure a project will be available in the products wonderful graphical interfaces, one should create an empty project within the UI with placeholder files for processes, rules, and whatever else you need. It is then a simple matter of running a git clone of this project into your favorite IDE to start migrating your project.

Once you have the project cloned, you can add your assets into the project in the correct locations based on the placeholder files. For example, I created an empty customer.bpmn2 file and added my customereval.bpmn2 file right next to it. I proceeded to then remove the old placeholder file and push this all into the repository. The UI of the product automatically picks up the changes and my process asset appeared for use in the designer.

Rules files import this same way without incident, other than that you will need to ensure your package name is aligned with your new project structure. The product has a UI that is tailored for a more business oriented user, therefore you can expect the old package naming of the customer evaluation demo, org.jbpm.customer.evaluation, to be more simplified. Ours turned out to be a simple package name of customer.evaluation so we adjusted this in our rules file and all was good.

The model for our project consists of two Java classes, or POJO's, a Request and a Person. These needed to be imported into the correct location for the form modeler component to identify, and they would not appear until the package name was corrected as discussed above.

There is a fundamental change in how you access your projects assets, so once you have the rules, processes, and your projects model in the product, this will be main available via a maven repository, built as a simple jar file. Below we will cover these details in the section Maven.

This means you can split your project into the code project that leverages your rules, events, and processes and the actual artifacts themselves. They will be contained in a project that deploys a jar that you leverage in your application code. Your unit tests will reside in your applications code project and leverage the generated jar dependencies.

The API's

The core API of the products has been fully refactored. You have to migrate everything you did to interact with the core of rules, events, and processes.

Eventually.

For now, you can use the provided backwards compatibility found in the knowledge-api.jar provided just for the projects that want to ride the old waves. Currently it can be found in the deployable-generic.zip, but that could change as the product approaches general availability (GA) status.

As for the other half of your enterprises code base, the unit tests that leveraged the jbpm-test.jar will need to be refactored. This jar does not provide for any backwards compatibility and we had to rewrite our existing unit tests. The good news is that the code is simplified, making your unit tests cleaner and easier to understand.

For both these jars, you can add them to your maven dependencies once these are made available. We have included and example internal repository where the maven dependencies are found, purely for your information in the migrated customer evaluation project.

The RestAPI has also changed. It will require some work to re-engineer your custom user interfaces that you might have created. The RestAPI provides you with access to the following areas:
  • Jobs
  • Repositories
  • Organizational units
  • Projects
  • Process instances, with or without vars (start, variables, details, abort, signal)
  • Work items (complete, abort)
  • History to view process instance completed
  • Comprehensive task interface
You can find documentation on this online at the Customer Portal.

JCR to GIT tooling

There is a community tool for migration of existing JCR repositories to the GIT repository format. At this time there was nothing to test but it is being exercised in the productization process.

Will this be the hammer that makes all your migrations look like a nail waiting to be hit?

Stay tuned for more on this as it has yet to be included in the early Beta releases.

Maven details

JBoss BRMS & BPM Suite products maintain a maven repository that you can add to your project for accessing the rules, events, and process project dependencies. Just add the following to your project pom file and you will be ready to locate dependencies:


   guvnor-m2-repo
   Guvnor M2 Repo
   http://localhost:8080/business-central/maven2/


As an example, assume that we have defined our customer evaluation project properly with a GAV (GroupID, ArtifactId, Version), we can then add the dependency for the version 1.0 jar as follows:


      customer
      evaluation
      1.0


Finally, the most important tip here is to never clone your repository from the filesystem, but always use the running product git URI. Referring to our running example of the customer evaluation demo, you would clone that outside of the product using CLI or your favorite IDE by accessing the project under:

# Never use the filesystem directly as it is not monitored by the product,
# so this is a bad practice: 
#
#    git clone file://{path-to-repo}/.niogit/customer.git
#
# This is the best practice, for example using git from a shell:
#
$ git clone git://localhost/customer

Cloning into 'customer'...
remote: Counting objects: 562, done
remote: Finding sources: 100% (562/562)
remote: Getting sizes: 100% (435/435)
remote: Compressing objects:  89% (388/432)
remote: Total 562 (delta 24), reused 72 (delta 21)
Receiving objects: 100% (562/562), 59.21 KiB, done.
Resolving deltas: 100% (198/198), done.

Task updates

The JBoss BRMS 5 product provided a task server that was bridged from the core engine by using, most commonly, the messaging system provided by HornetQ.

The new JBoss BPM Suite product will provide only support for the task server running locally, so no more messaging to be setup. To help you bridge the gap until you can migrate this in your current architecture, there is a helper or utility method, LocalHTWorkItemHandler. It can be found in the source code (separate download) if you want to investigate further at
jbpm-human-task/jbpm-human-task-workitems/src/main/java/org/jbpm/services/task/wih/util/LocalHTWorkItemHandlerUtil.java

Furthermore, the TaskService API is part of the public API, so there are just a few things to keep in mind when migrating:
  • package changes will cause a bit of refactoring your imports
  • some API changes will cause refactoring of methods
Customer evaluation demo
As most customers have created custom interfaces and interacted extensively with the human task component, expect to have some work here to migrate this area of your architecture if using tasks in your processes.

Migration in practice

Looking specifically at the project customer evaluation, we wanted to migrate a simple application that contains rules, a model, a unit test, and a process. This migration would provide factual evaluation as to the ease with which various aspects of the application could be migrated.

Here we would like to present the findings and point you to the project results (ongoing) of the migrated customer evaluation demo.

Unit Tests

We started with the unit tests and updated the pom.xml file to point to the internal production maven repository and included just the dependencies for the knowledge-api, plus the jbpm-test jar. This code snippet shows just the generic entries for the necessary jars, leaving out the exact version that is set as a property for the current release. You will also note that we leave out the repository entry that will be set to the maven repository you have the product dependencies stored in.


   org.jbpm
   jbpm-test
   ${bpm-suite-version}
   test



   org.drools
   knowledge-api
   ${bpm-suite-version}
   compile


Results of migration unit test.
Once these dependencies are in your project you can then begin the refactoring needed to change your current unit tests into the ones you will find working in the projects folder.

This includes an entry to eventually pull in the jar compilation of the product hosted artifacts, see the comments inline within the pom.xml file.

The initial setup used to involve a KnowledgeBase and a StatefulKnowledgeSession.

This has been reduced to just setting up a session strategy and RuntimeEngine.

# The createRuntimeManager() method and getRuntimeEngine() method are 
# both part of the provided testing harness found in JbpmJUnitBaseTestCase
# class that you can extend all unit tests off of.
#
createRuntimeManager(Strategy.SINGLETON, resources);
RuntimeEngine runtime = getRuntimeEngine(ProcessInstanceIdContext.get());

Where the older unit tests had to manipulate the sessions, we now have a streamlined case for each unit test.

@Test
public void underagedCustomerEvaluationTest() {
 // setup of a Person and Request.
 Person underagedEval = getUnderagedCustomer();
 Request richEval = getRichCustomer();

 // Map to be passed to the startProcess.
 Map params = new HashMap();
 params.put("person", underagedEval);
 params.put("request", richEval);

 // Fire it up!
 System.out.println("=========================================");
 System.out.println("= Starting Process Underaged Test Case. =");
 System.out.println("=========================================");

 KieSession ksession = runtime.getKieSession();
 ksession.insert(underagedEval);
 ProcessInstance pi = ksession.startProcess("org.jbpm.customer-evaluation", params);
 ksession.fireAllRules();

 // Finished.
 assertProcessInstanceCompleted(pi.getId(), ksession);
 assertNodeTriggered(pi.getId(), "Underaged");
 ksession.dispose();

 System.out.println("======================================");
 System.out.println("= Ended Process Underaged Test Case. =");
 System.out.println("======================================");
}

You will find the completely migrated unit test in the project src/test/java/CustomerEvaluationTest.java and can run this as a JUnit test.

From IDE to UI

The final step would be to import the existing rule, two Java classes that make up our domain model, and the BPMN2 process.
Designer with imported process.

To achieve this we started our JBoss BPM Suite and create a new repository and project. We then created empty placeholder files for the process and rule.


Back in our IDE we cloned the project with git clone git://localhost/customer and proceeded to locate the exact files we had inserted. We then removed these and added our existing rule and process files. After pushing them back into the project, they appeared in the UI project explorer. They only needed adjustments to the packaging as that had changed when we created our project, from a long package name to just customer.evaluation.

Importing the model was the same story, first creating an empty model via the form modeller
component and then replacing the file with our two java objects. Once the packages were adjusted to match the project definition, they appeared in the UI.

Form modeller with imported model.
The form modeller creates objects with annotations and our objects currently do not have them. This is causing some issues when we try to run the process (which builds and deploys). The JBoss BPM Suite attempts to generate a user task form to submit the initial process variables, but as they are objects and not the string fields we are provided, this fails.

Conclusions

These are the early days of JBoss BRMS & BPM Suite products, so an early look at the migration possibilities is just that, an early look. This is not the definitive guide to migrations, but a summary of the areas that will be affected and what you can expect based on a small sample application.

The issues around annotations on our model, dealing with importing a model, packaging paths all seem to be worth investigating further. This should be taken care of once the final documentation is provided for the product.

Note that the projects/customer-evaluation-demo is intended to be imported into your JBoss Developer Studio and interact with the running project in the BPM Suite. This is currently a work in progress, so watch for progress updates as the final product launch approaches.

We will continue to migrate our other demo projects and follow up with updates of what is encountered along these lines. Each project will be more complicated and involve exercising more and more of the product functionality, integration, and usability.

Monday, November 25, 2013

JBoss Developer Day in London 2013

Next week the Red Hat UK team has put together a lively schedule filled will excellent topics that will be presented by some of the best speakers on JBoss topics running around in Europe.

It will be held on Thursday, 5 Dec 2013 at Shoreditch Works Village Hall in London. It kicks off at 0930 hrs with registration and finishes up by bleeding over into the JBoss Architect MeetUp at 1730 hrs.

I was invited to host two sessions, one on the upcoming Red Hat JBoss BRMS & BPM Suite products and another based on the OpenShift Primer.

A look into the crystal ball at JBoss BRMS and BPM Suite

(10:15 - 11:00 hrs)
There is nothing like previewing the future of Business Rules and Business Process tooling. Be among the first one to leave footprints in the fresh snow as we take you on a tour of the JBoss Business Rules Management System (BRMS) and JBoss Business Process Management Suite (BPM Suite).

Attendees will be provided with the background architectures, a live demo of their capabilities, and a look at how they are Cloud enabled by the OpenShift cloud service. Join us for an hour of rules, processes, cloud, and crystal ball gazing!

OpenShift Primer - Get your applications into the cloud

(11:55-12:40 hrs)
Ever wondered about the new Cloud offerings out there? What is a PaaS? What is this thing called OpenShift?

Whether your business is running on applications based on Java EE6, PHP or Ruby, the cloud is turning out to be the perfect environment for developing your business. There are plenty of clouds and platform-as-a-services to choose from, but where to start? Join us for an action-packed hour of power where we'll show you how to deploy your existing application written in the language of your choice - Java, Ruby, PHP, Perl or Python, with the Java project of your choice deployed into the OpenShift PaaS in just minutes. All this and without having to rewrite your app to get it to work the way the cloud provider thinks your app should work.

If you want to learn about OpenShift PaaS and see how investing an hour of your time can change everything you thought you knew about the Cloud!

(Speaker author e-book: OpenShift Primer, might give away free copies in this session)

See you there? 

Friday, November 15, 2013

Red Hat JBoss BPM Suite - Automated Lending with a Generic Loan Demo

Red Hat JBoss BPM Suite Generic Loan Demo

This article is brought to you by an example of our strong links to our partners, people who understand and leverage the Red Hat JBoss middleware products for their customers.

Last week for current Red Hat customers we have made the Red Hat JBoss BPM Suite Beta1 available. This is a milestone release on the way to a final version 6 release.

This demo originated from Dan-Grigore Pupaza who works for a Red Hat partner.

Without going into details that will be presented upon a final Beta release announcement soon, I wanted to give customers with access to the Beta1 release a head start by providing a completely automated setup of the JBoss BPM Suite, with a pre-configured generic loan demo project out of the box.

This project is setup like all my previous JBoss demos and therefore should be a snap for you to get started with. You just need to obtain the project, download the products from the Customer Portal, and push the start button.

Easy as can be!

For more details here is a bit of a walk through to get you on your way, starting with the Github hosted project bpms-generic-loan-demo.

Get project
# You will want to clone the project as follows.
#
$ git clone https://github.com/eschabell/bpms-generic-loan-demo.git

With this project still based on the Beta releases, the final documentation has not been added, therefore I provide the walk through in this article instead. This will be replaced with details quickstart documentation in the project you cloned above in the future, including a slide overview of the project architecture.

For now lets look at the directories and files provided.

Project structure
README.md - contains instructions and details to get started.
init.sh - the script to install and configure products and demo.
installs/ - directory to put the products for this demo, see README file there.
projects/ - directory containing the developer demo project for JBDS import.
docs/ - directory containing eventual demo documentation.
support/ - directory with all supporting files and configurations for installing project.

Once you have cloned this to your machine, you can then go to the Customer Portal and download the JBoss BPM Suite Beta1 product.
Download the last entry for JBoss EAP 6

The file you have downloaded will be called jboss-bpms-6.0.0.Beta1-deployable-eap6.x.zip, you will also need to download JBoss EAP 6.1.0, which can be found in the Customer Portal also.

Install products
# Download & copy to the installs directory. 
# Ensure that this file is executable by running:
#
$ chmod +x installs/jboss-bpms-6.0.0.Beta1-deployable-eap6.x.zip
$ chmod +x installs/jboss-eap-6.1.0.zip

Now you can execute in the project root directory the provided init.sh (or init.bat) file.

Installation output

You will now note that you have a new directory, target/ that contains the JBoss EAP server, an installation of JBoss BPM Suite, and a pre-configured generic loan demo project which you can start as follows.

Start JBoss BPM Suite
# The will run with this startup, installing a maven repository from
# the JBoss BPM Suite in the directory you start it from. 
#
$ ./target/jboss-eap-6.1/bin/standalone.sh
JBoss BPM Suite login

Once the product is started you can open a browser window to login to Business Central of the JBoss BPM Suite.

http://localhost:8080/business-central

There are a few roles defined and configured for the human task that is part of the generic loan demo.

User roles for demo
  • User erics with password bpmsuite, has all roles and admin rights.
  • User alan with password bpmsuite, has Loan Officer role.
    Select Project Authoring
For ease of initial use, login as the first user with full rights to use all functionality in the product, which will be shown in the screenshots used for the rest of this post.

After login you will see the initial screen with links to various parts and components of the JBoss BPM Suite. It has been pre-loaded with the generic loan demo so no need to use the Authoring -> Administration menu where you would start to either create a new repository and project, or import an existing one from some Git repository.

Project Explorer
We will go straight to the generic loan demo to inspect, build, and deploy our first instance of the process by selecting Project Authoring from the listing on the left of the screen. This will take you to the empty Project Explorer view with the generic loan project pre-selected in the right hand menus. This will then load all the existing project artifacts into the Project Explorer business user browser on the left hand side.

You can explore the various assets at your leisure and we leave that exercise to the reader. Please try to remember, this is an early Beta access version and there are issues to be fixed, see the project README.md for more details on what you can expect to encounter.

Project Editor
Now we want to build and deploy the project, so that we can start our very first instance to run through the demo. To do this we need to open the Tools -> Project Editor which will give you the Project Screen that has a Build & Deploy button at the top right corner.

Hitting that button will give a green bar pop-up that says Build successful if all goes well.

Build & deploy project
Now you can open the Process Management -> Process Definitions at the top to get to view your deployed project. You will see a single entry for the LoanApp and you can inspect it by clicking on the search spy-glass icon on the right, which provides process details.
Process started

The button New Instance at the top can be pressed to deploy a new process, which pops-up with your first form to submit a loan application.

The following data can be filled in to initiate the process.

Submit form
  • Name: erics
  • Age: 30
  • Income: 3000
  • Amount: 10010  (auto approval if under 10k, no human task)
  • Period (in months): 24
Hit the submit arrow at the bottom of the form and then you can then inspect the process progress, view the task list, and complete tasks as needed.

Monitoring (BAM)
For monitoring you can view the Process & Task Dashboard, especially as you claim and complete tasks from the Tasks List.
Monitoring dashboard (BAM), 1 completed

This completes the quick overview, which gets you started on working with the JBoss BPM Suite product.

One final note, the entire demo is running in memory, so if you restart your JBoss BPM Suite, you will lose your process data, instances, etc. Just re-run the jar tooling discussed above to reset your installation.

Open Source Conference Amsterdam 2013 - JBoss Integration, BPM, and xPaaS talks abound

I will be attending the Open Source Conference 2013 in Amsterdam, hosted by Red Hat in the Amsterdam Beurs van Berlage (the old stock exchange building) on the 6th of December.

Traditionally this event draws a great crowd, over 1000 attendees the last few years, registration is completely free so sign up now!

I will be giving the following two talks.

The JBoss Cloud Guide to all things xPaaS

Whether your business is running on applications based on Java EE6, PHP or Ruby, the cloud is turning out to be the perfect environment for developing your business. There are plenty of clouds and platform-as-a-services to choose from, but where to start? 

Join us for an action-packed half hour where we take you through the Cloud Guide that covers everything and the kitchen sink! We have all the examples, demos, and practical tips for ratcheting up your knowledge of what is available right now in the world of open source JBoss based xPaaS functionality. Not only will you be able to setup diverse PaaS solutions, you will be shown how to leverage your existing application with the product of your choice - examples with JBoss BPM, Switchyard, Opta Planner, JBoss Mobile, JBoss Portal, and more leveraging the OpenShift PaaS in just minutes. 

If you want to learn more about the practicality of Red Hat's xPaaS vision and the role JBoss can play, see how investing an hour of your time can change everything you thought you knew about putting your business applications in the cloud, this session is for you!

What’s new in JBoss Integration & BPM World

Join us for a session on the coming product launches of Red Hat JBoss Fuse Service Works (FSW), Red Hat JBoss Business Rules Management System (BRMS), and Red Hat JBoss Business Process Management Suite (BPM Suite). We will walk you through these exciting new technologies, what they are going to mean to you, and how they can be leveraged to expand your business into the future.

JBoss FSW is Red Hat’s middleware solution for application integration, messaging, SOA, and service governance requirements. It combines the core ESB technology from our Fuse product and technical innovations from popular open source communities like SwitchYard and Overlord. JBoss BRMS and BPM Suite are Red Hat’s next generation products for maximizing your business activities with rules, events, reporting, and processes by leveraging the popular open source communities Drools and jBPM.

Wednesday, November 13, 2013

Devoxx 2013 impressions of a JBoss OpenShift Primer

This year spending a few days at Devoxx 2013 in Antwerp with some of the JBoss friends I have, both old and new.

This event is amazing for the volume of attendees, 3500, and the quality of the talks is only paralleled by the value of networking with all of your fellow Java contacts.

I spent time chatting with Ray Ploski, Mike Piech, Koen Aers, Dan Allan, Dimitris Andradis, Emmanuel Bernard, Xavier Coulon, Tim Fox, Arun Gupta, Gavin King, Jason Porter, Burr Sutter, the local SA team, many customers, and a vast array of partner contacts.

I sat in on a few sessions but I had the most fun chatting with customers, partners, and users of the JBoss projects and products. There were also a nice set of mini JBoss sessions given throughout the conference days at the Red Hat booth.

My talk was in room 9, a large movie theater with about 300 attendees.



The following is a collection of pictures to give you a bit of a feel for the Devoxx experience.


There were also various mini sessions held at the Red Hat booth throughout each day. I was scheduled to give a talk on Wednesday, but something came up that prevented me from making my slot. I post the slides here for your enjoyment none the less.


See you next year at Devoxx 2014!

Tuesday, November 5, 2013

Red Hat JBoss BRMS - the Cool Store Demo setup now fully automated

Red Hat Cool Store
It is time for another release of the JBoss Business Rules Management System (BRMS) Cool Store Demo.

This is release v1.4,  a fully automated setup experience. You no longer need to add maven configuration tweaks to your own setup, it is all taken care of for you inside the project configuration.

We hope you enjoy the example project that Jason Milliron put together, an example web application based on the popular framework Vaadin which is an online shopping cart. This web application demonstrates interaction between a web front end and a decision table and rules package. This allows the business logic to become externalized from your deployed application and can then be modified as needed at runtime. This application leverages the rules to calculate the shipping costs based on your rules in the table below.

Shipping pricing table
It is pretty simple really, you can adjust how much the ranges are and what the shipping for the shopping cart total order will be by tweaking this table, for example:

  • the price from Tier 1 based on value totaling between $26 - $50 is $5.99
  • you can fill your cart with under $25 of materials to validate
  • adjust it to $6.99 (as shown in yellow)
  • save and commit changes
  • build your coolstore package
  • clear the shopping cart application
  • re-order the same materials and validate the charge to shipping is now $6.99

See the provided documentation and Readme file in the project. You will also find a complete BRMS rules package with unit test scenarios. This is a complete project.

Enjoy!

UPDATE: Three part video series covering the functionality in this demo project is available now, get started with Part I - Installation.

Monday, November 4, 2013

Enhancing your JBoss Integration with JBoss BRMS in Practice

In the previous article in this series, we talked about extending and expanding your enterprise integration to account for an expanding architectural landscape that included diverse backend systems.

In this article we want to provide an example project, called the BRMS Fuse Integration Demo, that demonstrates how to achieve some of the discussed use cases, specifically how to integrate your service bus with a business process engine.

Introduction

The main focus of this article will be an actual integration project that provides you with an architectural blueprint for calling out to your Red Hat JBoss Business Rules Management System (BRMS) engine from your Red Hat JBoss Fuse service bus messaging routes. The use cases that were discussed in the previous article were as follows:

Use cases

  • call JBoss Fuse (Camel) services from a business process (BPM)
  • call JBoss BRMS to apply rules from JBoss Fuse (Camel) route, such as content based routing rules
  • call a business process from a JBoss Fuse (Camel) route
The project we provide covers the last use case, where we want to trigger a business process from one of our JBoss Fuse (Camel) routes. Our project provides the following aspects to provide you with a quick way to get started and an architectural blueprint.

Example project

  • Automated installation of JBoss Fuse
  • Automated installation of JBoss BRMS
  • Example BPM project deployed to JBoss BRMS
    • Process is a three step process (Start → “Hello World” → End) that logs a message on execution
  • Example (Camel) route deployed to JBoss Fuse
    • Fuse (Camel) route that is triggered by messages from a specific data directory
    • Logging of message from route
    • SOAP Web service call from route to collect external information
    • REST service call from a Bean from the camel route to start the external business process 

JBoss BRMS and Fuse demo project

The reference project shows an example of integrating JBoss BRMS with a focus on the BPM component and JBoss Fuse. The environment consists of a JBoss Fuse instance with a Fuse (Camel) deployment and a JBoss BRMS instance with a BPM project. We touched on the business process, but let us examine the rest of the projects in more detail.

We have designed our architecture to loosely couple the business process allowing access by other components, like our JBoss Fuse example project, by using a REST client from our Camel route. The REST client uses the Process ID and the proper user credentials to start a new instance of the business process.

Peek under the hood

The demo project will execute a lot of the mechanics out of our sight, so let us take you on a tour of what is happening under the hood of our project. If all goes according to plan it would step through our project as follows:
  1. The src/data directory defined in the Camel route is checked for xml messages which contain a stock code in a SOAP message. In our example we are using RHT as the symbol to get stock data on from the external SOAP Web Service. Open up the message1.xml file to see the sample SOAP envelope and body.
  2. When a xml file is found then the body of the message is read in and displayed in the log message.
  3. Next the message is sent to the external SOAP web service to get the stock information.
  4. The response that is returned is then displayed in the log message.
  5. Next the startProcessFromCamel method in the RestClientSimple is called to start the business process that prints hello world. Additional information on calling the RestAPI that is provided by JBoss BRMS BPM component is found below. As noted in the section Future work, the stock data will be sent to to the business process.
  6. The process id is displayed in the log message.

The Fuse Component

The Fuse project starts with our simpleRoute project, which contains two parts. The first is our RestClientSimple class, which allows us to define the business process ID and the user credentials. We need this class in when dealing with starting our process through the JBoss BRMS BPM RestAPI. The second is our camel-spring.xml file which contains our bean and route. A bean is defined with startit as the ID and RestClientSimple as the class.

Here is a closer look at a section of the camel-spring-xml file.

<bean id="startit" class="com.jboss.examples.RestClientSimple"/>
<camelContext trace="false" xmlns="http://camel.apache.org/schema/spring">
<route id="my_Sample_Camel_Route_with_CXF">
<from uri="file:src/data?noop=true"/>
<log message="&gt;&gt;&gt; ${body}" loggingLevel="INFO"/>
<to uri="cxf://http://www.webservicex.net/stockquote.asmx?wsdlURL=src/main/resources/META-INF/stockquote.wsdl&serviceName={http://www.webserviceX.NET/}StockQuote&amp;portName={http://www.webserviceX.NET/}StockQuoteSoap&amp;dataFormat=MESSAGE"/>
<log message="&gt;&gt;&gt; ${body}" loggingLevel="INFO"/>
<to uri="bean:startit?method=startProcessFromCamel"/>
<log message="&gt;&gt;&gt; ${body}" loggingLevel="INFO"/>
</route>
</camelContext>

Note that the SOAP web service call to get stock data and then the call for the startProcessFromCamel method in the RestClientSimple class. We aren't currently passing the stock data to the business process, but that is possible, see the section on future work.

Our RestSimpleClient gives three options for interaction with our JBoss BRMS BPM deployment.

  1. RestClientSimple starts a process without parameters
  2. RestClientStartWithParam starts a process with parameters
  3. RestClientTask starts a process and complete a task with form data

In our case we are will be  using the first option, but for more information on the RestAPI see the Red Hat Customer Portal Knowledge base article.

Future work

This article has demonstrated how to integrate your service bus with a business process engine. This example project solved only one of the use cases and there are interesting extensions that could be added.

  • The business process can be replaced by a more extensive example process, such as the Customer Evaluation Demo to show both BPM and rule integration.
  • Parametrize the REST service such that diverse processes could be called. 
  • Pass the Stock data that was looked up in the Camel route as a parameter into the business process for display like the current Hello World.
  • Deploy the SimpleRestClient service in apart bundle within JBoss Fuse container. Currently it is a bean in the route but it could be set as a proxy service that would receive a processID, user name, and user password.)

These extensions we leave for you to work out, like homework exercises, as you explore the integration scenarios that JBoss BRMS and JBoss Fuse can solve for you.

(Co-authored by Kenny Peeples & Eric D. Schabell)