Sunday, October 28, 2012

BPM 11g Subprocess (Default, Loop, Multi-Instance & Event based) Exemplified

With some common use-case references, I will be making an effort today to explain how, when & where various different sub-processes are used in BPM 11g. A subprocess is nothing but an embedded/nested subprocess within the parent process.

A subprocess - in a very simple use-case can be used to organize & modularize certain set of activities based on its function for better readability.

One important point to note here is that a subprocess must have an incoming & outgoing sequence flow akin to other BPM activities with the only exception of an event-based subprocess.

Oracle BPM 11g offers two variants of subprocess activities;

1. SubProcess (Default): This can be implemented in 3 different fashions based on its loop characteristics;

a) None: Primitive form of a subprocess to just organize & modularize activities within a certain business function as depicted in the diagram. For example, in an order process BPM process, there may be certain activities such as getting credit score of the customer from a credit bureau agency (external), checking inventory of the products in the order from the inventory management system (example JD Edwards) which constitutes a business function namely "Pre-Process Order" which can be grouped under a subprocess.

b) Loop: Think of this option as synonymous to a regular programming language's for/while/do-while construct. When this option is chosen, a loop condition needs to be specified which will let the subprocess know the number of times it would loop itself before the process control flow comes out of it. The loop condition can be specified either as a simple or XPath expression. Additionally, "Loop Maximum" value can be specified which will act as a "break" condition to come out of the loop.

If you had noticed, I referenced for/while & do-while constructs. Interesting to note here that a do-while would process the loop at least once even if the condition evaluates to false where as a while construct would loop only if the condition evaluates to true. This is exactly what the "Evaluate Before" option lets us do. By default this option is checked which means that the loop construct would act as a while and if unchecked would behave like a do-while.

Extending the order process use-case which has multiple orders in a process (bulk order processing), where the individual orders need to be processed sequentially (You might ideally would like to have them processed in parallel. But for whatever reasons - may be human resource crunch, the process analyst decides to have the orders processed serially :). Let us keep the use case going!).

c) MultiInstance: This is very similar to a loop subprocess except that this option would enable parallelism. This allows multiple instances for each item in a collection either based on the cardinality or collection data. Cardinality allows loop condition to be specified where as collection accepts the collection data. For instance, if we have a collection of orders that needs to be processed in parallel rather than sequentially, we would opt in for a MultiInstance subprocess which creates a task for the Finance user for every order simultaneously.


2. Event SubProcess: This is the next variant of subprocess which can exist independently in a main BPM process which means that it doesn't need an input & output sequence flow. Whenever, an event is triggered this subprocess can listen to those events and get invoked. Similar to event based gateway, catch & throw events, the event-based subprocess can be triggered with a message event, timer event, signal or on error. Also, the same can be configured to be "Interrupting" which will break the main process flow on event.

Let us now add some flavor to the order process use-case by adding fraud handling capability. We will now build a event-based subprocess which will handle fraud and will be triggered based on a message. The finance reviewer can trigger a fraud event which will be sent to the fraud analysis team for further diagnosis.


That completes the BPM 11g subprocesses usage. Watch out for more on individual subprocesses & their intricacies in my next posts.

8 comments:

  1. Hi eventagency,

    You are welcome. I appreciate your comments and glad that the post was of some help. Keep visiting :)

    ReplyDelete
  2. Great article..Nicely Explained.

    ReplyDelete
  3. Hi Sathya,

    Good insight into sub process. Embedded sub process also has an option for sequential multi instance processes. Have you tried this. I use multi instance sub processes for parallel processing. What could be the difference between serial multi instance and normal loop.

    Thanks,
    Sai

    ReplyDelete
    Replies
    1. Yes, a multi instance would process the loop entries simultaneously where as the loop option would process it sequentially. It purely depends on the business case.

      Delete
  4. Hello! Question about 2. Event SubProcess: how to call Event SubProcess (Start2) in main process?

    ReplyDelete
    Replies
    1. Vladimir, As the name indicates, event subprocess is triggered whenever an event happens. This could be any kind of event such as "on message", catch / throw events etc.. It depends on what kind of events the subprocess subscribe to.

      Delete
  5. Hi Sathya,

    Could you please share the source code files for these examples . it will be great help for me.

    ReplyDelete