This presentation was given at Magnolia Conference 2013 by Maciej Swiderski, Senior Software Engineer at Red Hat (http://www.redhat.com) and Espen Jervidalo, Senior Software Engineer at Magnolia International.
When discussing the integration between Magnolia and jBPM as part of Magnolia's workflow, there are several parts that might be worth to know when designing your own processes that will be included in the platform. Even if the integration comes out of the box some level of customization is possible and gives the opportunity to take advantage of the powerful workflow engine.
A joint effort of engineers from Magnolia and jBPM will allow to efficiently present currently available capabilities and provide more ideas on how it could be extended. Moreover, the workshop nature of the talk allows people to ask questions and get immediate feedback from core developers.
Streamlining Python Development: A Guide to a Modern Project Setup
Get the Maximum Out of Your Magnolia Workflow
1. Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1
Espen Jervidalo, Magnolia International
Maciej Swiderski, Red Hat, jBPM core developer 19.09.2013 at Magnolia Conference
Magnolia Workflow and JBPM
1
Friday, September 20, 13
2. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Outline
jBPM
Magnolia Workflow
• Usage
• The Pulse - your user
task hub
jBPM Integration
• Content Apps
• your processes
Outlook
2
Friday, September 20, 13
3. Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1
jBPM
3
Friday, September 20, 13
4. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
What’s Business Process Management?
4
A business process is a process that describes
the order in which a series of steps need to be
executed, using a flow chart
Friday, September 20, 13
5. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Why we need BPM?
Higher level
Visibility
Continuous improvement
Increased agility
Speed of development
Monitoring
Automation and orchestration
5
Friday, September 20, 13
6. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
jBPM Business Process Management Suite
Standards based, embeddable, lightweight Java process
engine, supporting native BPMN 2.0 execution
BPMN 2.0 process modeling in Eclipse (developers) and the
web (business users)
Human interaction using an independent WS-HT task service
6
BPMN2 processes
Pluggable human task
service
Business Process Simulation
Friday, September 20, 13
7. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
jBPM Business Process Management Suite
Tight, powerful integration with business rules and event
processing
Process collaboration, monitoring and management through
the Guvnor repository and the web console
7
Friday, September 20, 13
8. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Domain specific processes
Build domain specific processes by using custom activities (work
items)
Extend palette with domain-specific, declarative service nodes
Define input / output parameters
Runtime binding (work item handlers)
8
Friday, September 20, 13
9. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Domain specific processes
Benefits of domain specific processes
• Domain specific
• Declarative
• High level
• Reusable
Examples
• Email
• Twitter
• Google Calendar
• FTP, WebService, REST
• YOUR SERVICES!
9
Friday, September 20, 13
10. Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1
Magnolia Workflow
10
Use case
User Interaction
Friday, September 20, 13
11. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Workflow - Use case
Four eyes principle
Two users
• Editor
• Publisher
Publication from author
instance to public
11
Friday, September 20, 13
12. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Workflow - Interaction with user
Workflow process
• service tasks
• user tasks
How does the process interact
with users?
• The Pulse
12
Friday, September 20, 13
13. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
The Pulse
13
The Magnolia
communication hub
Single entry point for
user
Friday, September 20, 13
14. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
The Pulse
14
Friday, September 20, 13
15. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Publication Demo
15
Friday, September 20, 13
16. Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1
Integration & Extension
16
Content apps
Extending the workflow
• Custom processes
• Custom activities
Friday, September 20, 13
17. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Content App - Use workflow
Three command catalogs
• Default
• Versioned
• Workflow
Set the desired catalog in
your actions
17
Friday, September 20, 13
18. Workflow
Other EnginejBPM Engine
MyModule
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Extending the workflow module
Extend the default jBPM
implementation
• create a new module
• own processes
• custom activities
Change the engine
• your desired
implementation
18
Friday, September 20, 13
19. Registry
WorkflowMyModule
Workflows
Workflow
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Register processes
Model your processes
• BPMN2 modeler
Add them to your modules
classpath
Register in Magnolia by
configuration
19
Friday, September 20, 13
20. WorkItem
WorkItemHandler
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Custom Activities
Break the workflow up into testable, reusable units
20
Friday, September 20, 13
21. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Work item handlers
Access to data
• Workflow parameters
• From definition in magnolia
Dependency Injection
21
Friday, September 20, 13
23. Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1
Outlook - What’s in the pipeline
jBPM6
Pulse revised
Guvnor integration
23
Friday, September 20, 13
24. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
jBPM 6
brand new tooling (web based
that covers complete BPM life
cycle)
state of the art BAM
(Business Activity Monitoring)
capabilities
CDI integration out of the box
and much more...
24
Friday, September 20, 13
25. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Pulse revised
25
Friday, September 20, 13
26. Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1
Questions?
26
Friday, September 20, 13
27. Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
References
Magnolia documentation
• Workflow
jBPM documentation
• User guide
• Domain-specific processes
• Business Rule Task
27
Friday, September 20, 13
Notes de l'éditeur
Hi, I’m Espen Jervidalo, from product team at magnolia (and Maciej ....) and we would like to welcome you to the Magnolia Workflow and JBPM presentation.
For Magnolia 5 we have rewritten the workflow module from scratch based on jBPM, so first off we are going to give you - an introduction in jBPM - then have a look at a usage in Magnolia including a short showcase - and finally give you an idea on how to extend and integrate it into your projects followed by a short outlook
jBPM is, as the name suggests, all about BPM (Business Process Management) it’s an open source Business Process Management Suite, part of JBoss Community
Business process is something that strives at achieving business goal, and to do so we describe the activities (steps) that need to be performed to achieve that goal. Besides the activities itself we need to describe the order in which these activities should be executed. Flow chart (bpmn2 process diagram) allows us to describe the business logic graphically instead of doing low level coding which makes it much more readable for business users.
There is a quite few research materials available talking about BPM especially in contrast to programming and of course similar business could be achieved with just coding the logic in any language of choice but the clear advantage of using BPM is the possibility to talk about the actual business goal directly with business users (higher level). It provides much more visibility into what the process actually does, as compared to logic embedded in the application code. With powerful BPM suite while executing process you can capture number of metrics that allows you to improve your process and benefit from it even more. That opens an entirely new set of possibilities to continuously improve - BPM has it’s own life cycle so it alls for faster and more agile development.
You could stay only with modeling notation to document the business process within your organization but jBPM goes one step further and provides capabilities to actually execute these processes. With that said, jBPM is lightweight and embeddable process engine that focuses on executable business processes. It is based on standards (BPMN2 for modeling and execution), WS-HT for human interaction, BPSim for business process simulation. jBPM is not only the execution engine, it delivers several tools that makes the adoption of BPM much easier, like Eclipse modeler targeting developers, web based modeler targeting business users, management console, business activity monitoring dashboards, etc.
jBPM does not end on processes, it has excellent integration with business rules and complex event processing to empower your business and make the business goals achieved with more agility and control. To give more control over your assets (processes, rules, etc) jBPM comes with repository management tool - Guvnor - that allows to manage and govern your assets in central place. While at the same time promote collaboration when working on business assets.
To achieve higher level and visibility of the business process best is to “talk” directly the business language when modeling the process. We believe that introduction of domain specific process (activities within your process) allows you to take advantage of the knowledge you already have. When designing business process domain specific logic can be encapsulated as custom activities that have some characteristics - like input and output, these activities can then be shared and used directly from the modeling environment. While on execution time domain specific activities can be bound according to needs - e.g. different implementation on test and production environments.
As the name suggest it is domain specific so it already captures the logic specific to your domain. Next it allows to declaratively describe the work without going into details on how actually that will be done. Reusability is one of the important aspects for domain specific processes as it gives opportunity to share the knowledge and actual logic between different teams. jBPM comes with an concept of service repository where reusable services are stored that anyone can make use of and contribute back as well.
Let me start off by giving you an an idea of where and how a workflow can be used inside Magnolia.
We have the following scenario of two users: An Editor responsible for editing content on your homepage and taking care of change requests. Before those changes get available to the public you usually want somebody to be notified and review the changes. This is where the publisher comes in. So what happens in Magnolia is that the editor updates the content on the Author instance and the publisher publishes the changes to the public instance. This simple process applies to all content, not only to pages, but also to assets, articles, and whatever content you are dealing with in your environment
When looking closer at our use case, we realize that some of the tasks in the process can be handled automatically by the system, while others need some sort of user interaction.So you have service tasks executed automatically and user tasks depending upon user interactionIntegrating a workflow in your product also means defining how your users interact with the workflow.
In Magnolia we have The Pulse. It is used as a message hub for notifying users or administrators about the systems health and status. There are three different Notification types available- informational notifications- warnings- errors The pulse is not only Magnolias way to communicate with its users:As an app or module developer you have easy access to its API for keeping your end users up-to-date.
The Pulse is also where the workflow notifies users to take certain actions.It registers a new notification type called “work item”.If you you’re familiar with the workflow from Magnolia 4.5 this is the drop-in-replacement for the inbox.
So let me give you a short demo of the publication process in magnolia 5.
When it comes to integrating and extending the workflow module into your projects common use cases might be:- Enabling publication workflow for your Content Apps- Or you might need to define custom processes and activities
So let’s say you have an own Content App running and you would like to integrate the activation process into it. If you have developed an App inside Magnolia you probably know the concepts of actions. Actions are usually UI centric and reflected in the actionbar, on the other hand you have commands which are decoupled from the UI, so they can be triggered by UI actions, by a web services and are backend centric. Commands are organized into command catalogs, which basically are sets of commands. When talking about publication you have three different command catalogs available after installing the workflow- default, directly publishes changes from author instance to the public- versioned, creates a version in advance, so you’re able to keep track of changes and rollback if necessary- workflow. which will create a version and then launch the publication workflow as seen beforeAll you need to do is set the desired catalog in your actions. So when a user publishes changes, it picks the right catalog based on configuration. If time permits we will show this live based on the contacts app towards the end of the presentation.
Extending the workflow module is possible in different ways: Instead of doing changes directly to the workflow module you would create an own module and add your processes and implementations to it. The actual engine is separated into an own module, so if your feeling brave, you can even swap the default jBPM implementation by an engine of your choice. In this part we will focus on how to extend the workflow by jBPM processes and custom activities.
So let’s say you have a process which is not covered by Magnolias default ones. You start off with modeling your process in a graphical BPMN Editor of your choice. You end up with a graphical representation of your process as seen at the bottom. This creates you an xml file, which you add to your modules class path. After adding it to the workflows registry by configuration, it is available to be used inside Magnolia.
Inside your custom processes you might have defined custom activities as Maciej outlined in the beginning. Those are also referred to as work Items. Each workItem has its own handler. The nice thing about those handlers is you break the process into smaller testable and reusable units.
Here you have a little snippet of how the implementation of such handlers looks like. Start off by Implementing the WorkItemHandler interface and override the execute method. Two things I want to stress here is how you can access data inside your handler: The way magnolia loads those handlers allows us not only to retrieve data passed through the workflow using a parameters map (as seen in the execute method) but also to retrieve content from the definition, which is injected into the constructor. And by using Dependency injection, you can inject and access all classes that you need at this step in the process.
jBPM6 is expected to be out in October and it will bring brand new experience for BPM users, with completely redesigned tooling, GIT repository backend, state of the are Business Activity Monitoring tool to name just few. From development point of view out of the box CDI integration, improved engine management with configurable strategies, maven based deployment mechanism (knowledge archives) and much more. So stay tuned and get a moment to read through documentation that soon will be available.
In the next versions we will tackle some shortcomings related to The Pulse integration. - Work Items will be more clearly separated from other Messages - The review process will be simplified by showing more meta information - some selected actions, instead of all possibilities - dedicated app, giving a bigger overview and more sophisticated actions