Dec 27, 2007

Setting Variables

For setting variables ContextInstance is required. ContextInstance maintains all the key-value pairs for a process instance.
We can get ContextInstance from Process Instance.
ContextInstance contextInstance = processInstance.getContextInstance ();
Variable can be set as mentioned below using ContextInstance obtained from processInstance.
contextInstance.setVariable (“Variable Name”, “Value”);


JBPM Database Steps

One of the basic features of jBPM is the ability to persist executions of processes in the database when they are in a wait state.
1. First we create the JBPM Configuration.
Static JbpmConfiguration jBpmConfiguration = null;

This is static as same jbpm configuration can be used for the entire threads configuration.
2. All the configuration related information is stored in resource file “jbpm.cfg.xml”
3. The jBPM configuration is loaded.
jBpmConfiguration = JbpmConfiguration.parseResource ("jbpm.cfg.xml");
4. Get the jBPM context from the jbpm configuration.

jBPMContext = jBpmConfiguration.createJbpmContext ();
5. Get the graph Session from jBPM Context
jbpmGraphSession = jBPMContext.getGraphSession ();
6. Get process definition from Graph Session
ProcessDefinition processDefinition= jbpmGraphSession.findLatestProcessDefinition (“Add Product”);
7. Get process Instance from Process Definition
ProcessInstance processInstance = new ProcessInstance (processDefinition);
After getting the process Instance user can do whatever he wants to do.
Data will not not be persisted in database untill and unless jBPMContext is not closed

Dec 26, 2007

JBPM Architecture Continued !!


Action Handlers are contained in process definition and are executed in JBPM engine.When the process engine encounter a node during the execution of process instance which is derived from process definition, action handler associated with them are executed. Action handlers are instances of Java code that interact with external systems when executed.

Process Definition: A process definition is based on a directed graph (A ProcessDefinition is formal description of process represented as Java Objects). The graph is composed of nodes, transitions, one start state, and one end state. The type of each node defines the runtime behavior for the node. While a process definition executes, the following entities come into play:
Process instance: A process instance is one execution of a process definition. When a process instance is created a token is created for main path of execution called the "Root Token" and is positioned and the start state of the Process Definition.
ProcessInstance processInstance = new ProcessInstance (processDefinition);


Token: A token is one path of execution. A token is the runtime concept that maintains a pointer to a node in the graph.
Token token = processInstance.getRootToken ();

Signal: A signal instructs a token to continue graph execution by transition out of a node.When receiving an unnamed signal, the token will leave its current node over the default leaving transition. When a transition-name is specified in the signal, the token will leave its node over the specified transition. A signal given to the process instance is delegated to the root token.
token.signal ();

Node: Nodes are responsible for the continuation of a graph execution. When a token enters a node, the node executes. Node type determine what will happen when execution arrives at a particular node.A node that does not propagate execution is regarded as a state.
Action: Actions are instances of Java code executed when events occur in a process execution. The primary event types are "entering a node," "leaving a node”, and "taking a transition."

Overview of JBOSS JBPM Architecture

JBoss jBPM defines process definitions within files written using the JBoss process definition language e.g jPDL. JPDL is a graphic-oriented programming (GOP) language based on a model of nodes, transitions, and actions. In this model, nodes are traversed and executed as they are encountered during the flow of a process definition. Transitions direct the flow of execution of a process definition, and actions perform specific logic as a node or transition event occurs.
In jBPM, process definitions are packaged as process archives, when process definition is created using Process designer ".par" file is created. A process archive is passed to the JBPM process engine for execution. The JBPM runtime engine traverses a process graph (which is always a directed graph) and executes actions defined with various transitions and states or nodes.
JBoss jBPM mainly consists of following components.

Runtime engine: This component executes process actions, maintains process state, and logs all process events via the following components:

  1. A request handler
  2. A state manager
  3. A log manager
  4. A definition loader
  5. An execution service
Process monitor: There are various modules in JBPM one of them is Process monitor, which is responsible for auditing and logging.
Process language: The process definition language (jPDL) is based on GOP which is easier to use and can keep business and programmer on same page. Business can create the Graph (More or less like flowchart) and developer can implement the logic.
Interaction services: These services expose legacy applications as functions or data to be used in process executions

What is JBPM ?

In simple words Jboss jBPM is sophisticated state machine that can execute long running process that can be visualized graphically.JBoss jBPM is a JBoss Enterprise Framework that delivers work flow, business process management (BPM), and process orchestration in a scalable and flexible product footprint.
JBoss jBPM 3.0 delivers the capability of developing new automated business processes and work flows with industry-standard orchestration using Business Process Execution Language (BPEL), a flexible and pluggable API, a native process definition language, and a graphical modeling tool.

JBoss jBPM enables automation of business processes that coordinate between people, applications and services.

BPM Continued

BPM has three important phases.

Process design: The task of designing existing and new processes using various process design languanges such as jPDL (jBPM Process Definition Language), BPEL (Business Process Execution Language) etc

Process execution: The execution of an automated sequence of related events involving software processes and/or human activities

Process monitoring: Observance and auditing of the state of individual processes so that the statistics and performance of these processes can be recorded, reported, and optimized


What is BPM ?

The term BPM i.e business process management typically refers to a set of activities enterprises can employ to automate and optimize business processes in a manner adaptable to dynamically changing environments.

*BPM offers a programmatic structure for designing transactions and executing them using automated decisions, tasks and sequence flows. These activities usually seek help from software engineering and tools therefore, the term BPM is often used directly to refer to the engineering techniques and tools.

*BPM solutions typically include three components: an engine that executes process definitions, services that allow the engine to interact with the outside world, and tools that aid process development and monitoring.