Thursday, February 28, 2013

JBoss jBPM gets a correlation identifier for process instances

This is a community project posting to bring some news that might have skipped your attention in the flood of work being done to get the project ready for release v6. It is a feature I have been personally looking forward to that allows you to search for and find your process instances based on an identifier, we call this a Correlation Id.

What it would be good for is for example if you want to have an exception framework to handle your process exceptions in a consistent manner and remain in the process layer of your architecture, such as done in older versions of jBPM.

A description of the problem and the solution can be found in the issue at the project site, but for posterity I have places the listed example code on how to make use of this here.

CorrelationKeyFactory factory = KieInternalServices.Factory.get().newCorrelationKeyFactory();

// create your kbase here.
// create your ksession here.

CorrelationKey key = factory.newCorrelationKey("mybusinesskey");

// start process instance.
//
ProcessInstance processInstance = ((CorrelationAwareProcessRuntime)ksession).startProcess("com.sample.bpmn.hello", getCorrelationKey(), null);

// next the process instance can be found be correlation key:
//
ProcessInstance processInstanceCopy = ((CorrelationAwareProcessRuntime)ksession).getProcessInstance(key);

// Since CorrelationKey support is introduced to internal API it requires additional 
// cast to get access to correlation based methods.
//
// The above example code shows single valued CorrelationKey but multi valued correlation 
// keys are supported as well. To create multi valued correlation key:
//
List properties = new ArrayList();
properties.add("customerid");
properties.add("orderid");
CorrelationKey multiValuedKey factory.newCorrelationKey(properties);


// Then such key can be used exactly same way as single valued key is used.
//
// CorrelationFactory is responsible for providing the right instances of 
// CorrelationKey and shall be always used to build CorrelationKey objects.
//
// CorrelationKey does not have to be stored to be able to use it later on, 
// e.g. to retrieve process instance meaning can be recreated whenever it is 
// needed. Look up is based on values. In case of multi valued keys best is to 
// keep same order of properties every time correlation key is recreated.

Many thanks to the core jBPM team for getting this in there. Sometimes the small things are what makes our lives easier! ;-)

Monday, February 25, 2013

Mutt hints - viewing iCal calendar invites

This is not the first place this has been posted but I wanted to capture it for myself here. I am not attempting to auto import ical files, or your meeting invites, into my macbook calendar application. I just want to view the details inline of the meeting.

Add this ruby script to your path:

#!/usr/bin/env ruby

require "rubygems" # apt-get install rubygems
require "icalendar" # gem install icalendar
require "date"

class DateTime
  def myformat
    (self.offset == 0 ? (DateTime.parse(self.strftime("%a %b %d %Y, %H:%M ") + self.icalendar_tzid)) : self).
        new_offset(Rational(Time.now.utc_offset - 60*60, 24*60*60)).strftime("%a %b %d %Y, %H:%M")
        # - 60*60 to compensate for icalendar gem/Outlook mismatch
  end
end

cals = Icalendar.parse($<)
cals.each do |cal|
  cal.events.each do |event|
    puts "Organizer: #{event.organizer}"
    puts "Event:     #{event.summary}"
    puts "Starts:    #{event.dtstart.myformat} local time"
    puts "Ends:      #{event.dtend.myformat}"
    puts "Location:  #{event.location}"
    puts "Contact:   #{event.contacts}"
    puts "Description:\n#{event.description}"
    puts ""
    end
end

Add this to your .mailcap file:

text/calendar; icalview.rb; copiousoutput

Then finally, add this to your .muttrc:

auto_view text/calendar

Enjoy viewing your meetings now!

Friday, February 15, 2013

JBoss BRMS - update on how to create maven artifacts

Last months I showed you how to generate / extract the maven artifacts you might need for your JBoss BRMS product development projects. This included a script to install them in your local repository.

We have had some discussions around this script and it was not ideal as parent poms and dependencies were broken by this method. The parent poms have been constructed and placed in the location indicated by the functions found at the top of the script. Below you will find a more complete way to install these dependencies, including the parent poms to tie it all together. Credit goes to Maurice de Chateau for the following script:

#!/bin/bash
SRC_DIR=./installs
BRMS=brms-p-5.3.1.GA-deployable-ee6.zip
VERSION=5.3.1.BRMS

command -v mvn -q >/dev/null 2>&1 || { echo >&2 "Maven is required but not installed yet... aborting."; exit 1; }

installPom() {
    mvn -q install:install-file -Dfile=../$SRC_DIR/$2-$VERSION.pom.xml -DgroupId=$1 -DartifactId=$2 -Dversion=$VERSION -Dpackaging=pom;
}

installBinary() {
    unzip -q $2-$VERSION.jar META-INF/maven/$1/$2/pom.xml;
    mvn -q install:install-file -DpomFile=./META-INF/maven/$1/$2/pom.xml -Dfile=$2-$VERSION.jar -DgroupId=$1 -DartifactId=$2 -Dversion=$VERSION -Dpackaging=jar;
}

echo
echo Installing the BRMS binaries into the Maven repository...
echo

unzip -q $SRC_DIR/$BRMS jboss-brms-engine.zip
unzip -q jboss-brms-engine.zip binaries/*
unzip -q $SRC_DIR/$BRMS jboss-jbpm-engine.zip
unzip -q -o -d ./binaries jboss-jbpm-engine.zip
cd binaries

echo Installing parent POMs...
echo
installPom org.drools droolsjbpm-parent
installPom org.drools droolsjbpm-knowledge
installPom org.drools drools-multiproject
installPom org.drools droolsjbpm-tools
installPom org.drools droolsjbpm-integration
installPom org.drools guvnor
installPom org.jbpm jbpm

echo Installing Drools binaries...
echo
# droolsjbpm-knowledge
installBinary org.drools knowledge-api
# drools-multiproject
installBinary org.drools drools-core
installBinary org.drools drools-compiler
installBinary org.drools drools-jsr94
installBinary org.drools drools-verifier
installBinary org.drools drools-persistence-jpa
installBinary org.drools drools-templates
installBinary org.drools drools-decisiontables
# droolsjbpm-tools
installBinary org.drools drools-ant
# droolsjbpm-integration
installBinary org.drools drools-camel
# guvnor
installBinary org.drools droolsjbpm-ide-common

echo Installing jBPM binaries...
echo
installBinary org.jbpm jbpm-flow
installBinary org.jbpm jbpm-flow-builder
installBinary org.jbpm jbpm-persistence-jpa
installBinary org.jbpm jbpm-bam
installBinary org.jbpm jbpm-bpmn2
installBinary org.jbpm jbpm-workitems
installBinary org.jbpm jbpm-human-task
installBinary org.jbpm jbpm-test

cd ..
rm -rf binaries
rm jboss-brms-engine.zip
rm jboss-jbpm-engine.zip

echo Installation of binaries "for" BRMS $VERSION complete.
echo

Tuesday, February 12, 2013

IIE Home Loan Demo - Ready to Rumble with JBoss Integration?

The original Home Mortgage Demo project started out with Red Hat JBoss SOA Platform (SOA-P) and Red Hat JBoss Business Rules Management System (BRMS) to integrate rules, services, ESB, and BPEL orchestration to pre-qualify home loan requests. In later versions we took this demo project forward with the more recent versions of both JBoss SOA-P and JBoss BRMS, but the final step was to show an Intelligent, Integrated Enterprise (IIE) by leveraging the existing components, such as the decision services and the BPEL orchestration services.


Part I - introduction and project setup
We walk you through the setup and contents of the Red Hat JBoss Home Loan Demo. This will get you to the starting point and give you a good understanding of the architectural components involved.

This will get you up and out of the gate, ready to start a proof-of-concept, product evaluation, tooling evaluation, or just let you show off to your friends and colleagues.


Part II - developer tooling

This video will show you how to setup your JBoss Developer Studio with the Home Loan Demo project. We walk through the server setup, rules and business process tooling setup, importing your projects, building the bpm project, deploying the project artifacts and running them on the server for integration testing.


Part III - business interaction

This is the final part that walks you through the business process web tooling for the Home Loan Demo. We walk through importing your project in the Business Rules Manager, examine the Web Designer, look at our rules file, tour our process, build the package, deploy it to the Business Central and run our process. We also revisit the process to tweak business parameters to change the execution flow.


You now have a complete, repeatable, and interesting integration product demo that highlights JBoss SOA-P and JBoss BRMS functionality. Enjoy!

Wednesday, February 6, 2013

OpenShift Tips & Tricks - create your instance based on an existing project

The latest release of the OpenShift Origin project command line tooling gives us a powerful feature to shorten the steps it takes to setup, for example, the various projects demoed in my OpenShift Primer book. 

Below you will find a single example to demonstrate how much easier it is now to setup existing demo projects. You can update your install on osX with:

$ sudo gem update rhc

If you have not yet installed the client tooling, you can do that as follows on osX:

$ sudo gem install rhc

We used to need various steps to setup a project, like this mobile JBoss project DevDayUK:

Running on OpenShift

Create an account at http://openshift.redhat.com/
Create a jbosseap-6.0 application
rhc app create -a devdayuk -t jbosseap-6.0
Add this upstream cloudtour repo
cd devdayuk
git remote add upstream -m master git://github.com/eschabell/openshift-devdayuk.git
git pull -s recursive -X theirs upstream master
Then push the repo upstream
git push
That's it, you can now checkout your application at:
http://devdayuk-$namespace.rhcloud.com

We can now shorten this list of tasks dramatically as follows:

Running on OpenShift

Create an account at http://openshift.redhat.com/
Create a jbosseap-6.0 application
rhc app create -a devdayuk -t jbosseap-6.0 --from-code git://github.com/eschabell/openshift-devdayuk.git
That's it, you can now checkout your application at:
http://devdayuk-$namespace.rhcloud.com

I will be updating all my README.md files for all my projects over the coming days to reflect this improvement. 


Tuesday, February 5, 2013

JBUG OWL - the journey begins with JBoss BRMS Primer

This was to be a JBoss Business Rules Management System session, filled with an enlightening live demo to amaze the local JBUG OWL in Germany. It also signals the launch of a new topic in the Primer series.

The promised session was to be my first JBoss BRMS Primer. I have come up with a Primer series after the success of the OpenShift Primer that I took on the road last year and finally turned into an e-book. Here is the abstract of my talk and the slides used with a link to the two demos that were given.

JBoss Business Rules Management System (BRMS) Primer
This session will get you started with JBoss BRMS. It will walk you through some of the capabilities, components and basic concepts that one needs to understand to start building process and rule-driven applications. Join us for an hour or two of Business Process Management (BPM) concepts, explanations of how to capture your enterprises logic in business rules and a demonstration or two from real live processes that bring these concepts to life.


The demos I gave were the JBoss BRMS Customer Evaluation and JBoss BRMS Rewards demos.

The group was very nice, consisting of Java consultants, developers, a few managers, one or two sales and some of the local students braving the bad weather for some snacks, drinks and JBoss technology talks.

It opened with an overview of agile test driven development, which is a topic I understand, but challenged my rather rusty German. This was followed by an quick walk through the JBoss middleware stack, a break and then my session. 

I look forward to working with this group in the future as they were an interested audience and it is a short 3 hour drive through the beautiful German country side for me. Stay tuned, we are working on a follow up session later this year! ;)

Monday, February 4, 2013

EMEA JBoss Forum Tour - bringing integration & BPM to Europe

Just back from a four country tour through Europe talking about JBoss Integration products, meeting with customers, meeting with partners, and demoing the various technologies (JBoss Business Rules Management System, JBoss SOA Platform and OpenShift). It was a lot of fun, tiring, and filled with interesting people. I will try to give an overview of the various cities, events and happenings around JBoss in Europe as I experienced it.

Snow problems.
We started on Sunday evening, 20 January with Phil Simpson, JBoss BRMS Product Marketing Manager and myself meeting up in Madrid. It almost went wrong with a sudden snow storm in the area that grounded most air travel from Amsterdam Schiphol airport, but I got out with only a few hours delay.

Each location as split into a two day adventure. One day being the JBoss Forum with customers invited to enjoy JBoss talks, demos and good food from the local scene. The other day would be spent on local press interviews, customer meetings, partner meeting, and local sales team training sessions. Each country had its own plan around these items and each country was a different experience.

Madrid, Spain
Lunch meetings.
The first day started at the local PR offices with press interviews which resulted in an article being quickly published by MuyComputerPRO (translation required if you don't speak Spanish). From there we went to the offices of Red Hat in Madrid to conduct another interview via the telephone, then lunch with a local partner and finally a session with the local Sales teams to bring them the latest news on the Integration & BPM front. In the evening we had dinner with the local team and they showed us how to eat Spanish beef, with one guy who will remain anonymous actually finishing off a 600 gram steak!

Over full room in Madrid.
The second day was filled with the JBoss Forum. Initial the plan was to host a small event, but the attention it got resulted in room reservations having to change to the largest setup the hotel had. Even with Madrid having full on snow flurries, which everyone kept apologizing for and stating that it only happened once a year,  we ended up bringing in more chairs to accommodate the ~140 attendees.

There was a live translator (see the silver box in the room where translator sat) and about half of the attendees were listening in on headphones to catch our talks in their native languages. The translator asked us to speak in a steady pace, not too fast but not too slow either, which can be a bit confusing if you have a strong accent in your English.

Champs-Elysees session.
I ran the JBoss BRMS Customer Evaluation demo and the JBoss Rewards demo in my session. Pilar Bravo ran a session demoing the new Optima Planner product which went over very well. As the attendees finished the day up on the top floor of the hotel with drinks and food, Phil and myself headed for the airport to continue this adventure in France.

Paris, France
Travel went smoothly this time, we arrived in Paris and the hotel was at a great location, just off the Arc de Triomphe at the head of the Champs-Elysees.
JBossians in Paris.

The next day the JBoss Forum event was held on the Champs-Elysees just one floor up with the window next to the attendees giving you a great overview of the finish to the Tour de France. With ~95 attendees this was again a standing room only event and I demonstrated not only the JBoss BRMS Customer Evaluation and Rewards demos, but also the new Home Loan demo with BPM capabilities (blogging this new project soon). This Home Loan demo leverages both JBoss BRMS and the JBoss SOA Platform to integrate services, ESB, BPEL, rules and BPM.
Paris.

Again, in the evening we had dinner with some of my oldest JBoss friends and enjoyed some really nice French dining. It was nice to catch up with old friends and meet some new ones!

The second day gave Phil and myself the chance to wander a bit in the morning for breakfast and to get to the office for our Sale Team training session. It would not be proper to visit Paris and not get a shot of the Eiffel Tower. After our training session we headed off to enjoy our weekends before having to head out to Germany for week two of this tour.

Munich, Germany
Sunday evening flights got both Phil and myself into Munich, Germany with no delays nor much snow to worry about. It had been warming up a bit so most of the snow was melting.

The JBoss Forum event in Munich was again completely full with ~90 attendees. We even had attendees drop in from another event in the same building that turned out to be from our competitors, guess they were interested in JBoss Integration & BPM. Throughout the day there were several press interviews so watch for German language JBoss articles coming soon.

Munich JBoss Forum.
Late flights for both Phil and myself got us into Zurich late, but the weather there had warmed up enough to melt all snow. Can you believe it? A lack of snow in Switzerland, who would have expected that in January?

Zurich, Switzerland
The first day here was the JBoss Forum with customers and interested parties. This took place in a hotel down by the river in the center of Zurich and was very well attended. Not a single empty chair. I again showcased the JBoss Customer Evaluation and Rewards demos focusing on the business interaction with the Business Rules Manager and BPM web tooling. There were several attendees that approached me afterwards about how nice it all looked.

Zurich JBoss Forum.

The evening was again a team dinner with a local partner joining us to discuss eventual content for the partner workshop I was to give the day after. Phil Simpson traveled on to Geneva for a last JBoss Forum the next day.

OpenShift USB prize!
The final day was a workshop for partners with ~10 attendees. We ran through an OpenShift Primer session based on the book at their request which focused on JBoss Integration & BPM examples in the Cloud. The first participant to get an application onto OpenShift won an USB bottle opener! Next we took a detailed look at the JBoss BRMS demos given in the JBoss Forums. Each attendee was given a chance to install the demo locally during the workshop. Finally, we finished up with the Home Loan demo project and installed that locally for the attendees.

Travel home that evening was without hinder so the two week tour wrapped up nicely with memories of customer, partners and colleagues we had chatted with around Europe.

Friday, February 1, 2013

DZone - contribution goodie box

I have been working with the DZone site for some time now, sharing content and social media channels to promote technical middleware content around the globe.

I was pleasantly surprised to receive a box this morning that I was able to open while enjoying my morning coffee. Keep watching for more great JBoss, OpenShift and other middleware content on DZone as I plan to continue my activities with them.