Skip to content

plexiti/camunda-grails-plugin

Repository files navigation

camunda Grails plugin

This plugin integrates camunda BPM with the Grails 2 web application framework. It's therefore outdated in the sense that Grails 3 is out there since a long time. There is currently no work going on in the direction of porting this plugin to Grails 3.

camunda BPM is a flexible framework for workflow and process automation. It's core is a native BPMN 2.0 process engine that runs inside the Java Virtual Machine. It is a perfect match for the Spring Framework - and therefore for Grails, too.

camunda and grails logo

Currently the plugin comes bundled with a dependency to the release 7.3.0 of camunda BPM. However you can use it with all other versions, too.

## Deploy your first camunda Grails App in 3 minutes
1> grails create-app camunda-on-grails # and add a plugin dependency: compile ':camunda:0.4.0'
2> grails create-process my.own.camunda.GrailsProcess
3> grails war # and deploy it in the camunda BPM tomcat container

Then open http://localhost:8080/camunda-on-grails-0.1/camunda, browse to camunda tasklist and work with your own camunda GrailsProcess. But if you are new to camunda BPM and/or Grails, you might want to read the long story:

### 1. Create a fresh Grails App and install camunda Grails Plugin

Download and install grails, then on your command line, type

grails create-app camunda-on-grails

In your camunda-on-grails/grails-app/conf/BuildConfig.groovy, add to the plugins section

plugins {
    compile ":camunda:0.5.0"
}

and back in your camunda-on-grails project folder execute

grails refresh-dependencies
### 2. Create a fresh camunda BPM process definition

Still in your camunda-on-grails project folder, type

grails create-process my.own.camunda.GrailsProcess # or any other package and name of your choice

You should see the following two files generated by Grails:

| Created file grails-app/processes/my/own/camunda/GrailsProcess.bpmn
| Created file test/integration/org/my/own/camunda/GrailsProcess.groovy

It's a minimal process, to get you started and build upon (plus a small spec to check that it works). If you'd look at it with camunda modeler, it would look like

camunda BPM modeler

You will now already be able to use camunda BPM as internal process engine for your grails application. Maybe you want to grails test-app and have a look at the spock specification executed by that command. However, if you want to see camunda BPM tasklist in action, you will want to move on and ...

### 3. Download camunda BPM and deploy your Grails WAR file

Download camunda BPM Tomcat and expand it to a folder, let's call it $CAMUNDA_HOME. Start camunda BPM Tomcat by executing:

./start-camunda.sh

Back in your camunda-on-grails project folder, excecute

grails war
cp target/camunda-on-grails-0.1.war $CAMUNDA_HOME/server/apache-tomcat-7.0.50/webapps

Now open http://localhost:8080/camunda-on-grails-0.1/camunda. But don't browse to the invoice sample, instead directly select the tasklist application, login with username demo password demo and start your GrailsProcess by clicking on that button in the top right corner:

camunda BPM tasklist

The start form you will now see is delivered by your grails application:

camunda BPM tasklist

Make a selection in the required dropdown field and actually start your process. Then move to the tasks assigned to you and find the Sample UserTask. Select the "Diagram" Pane and see the simple process you just created by issueing grails create-process:

camunda BPM tasklist

The process execution is waiting at the user task, which wants to be completed via our grails form presented in the form pane.

Pretty cool, right? What's even cooler is that there is not much 'magic' happening behind the scenes. You just created a bpmn process definition (plus a corresponding 'spock' test specification) and use now a sample gsp form provided by the plugin. When reading the extensive camunda Grails Plugin documentation, you will learn that the plugin sets very few sensible defaults for you to get started quickly, but everything remains under your full control.

Congratulations! You are now "in driver's seat" of a rapid process application development framework, for both 'data' as well as 'process': your 'Sample Service Task' calls a Grails Service and in your embedded Task Form you can leverage server side gsp as well as client side js rendering and present all the context domain data necessary for the user to complete the task at hand.

To obtain your driver's license for that racing car, you might now want to...

## Get in touch with camunda BPM and Grails!

If you don't yet know either camunda or grails - it's very much worth a look! Go straight to the extensive camunda Grails Plugin Guide! But in particular check out camunda.org to get started with camunda BPM and grails.org to learn Grails in 5 easy steps.

## Resources

Want to contribute? Need help? You are very welcome! Please contact me directly via eMail.

## Maintainer

Martin Schimak - eMail - GitHub - Blog

## License

Apache License, Version 2.0