Why use jBPM with Mule?

motif

What is and why would you use it with ?

BPM stands for Business Process Management and simplistically can be thought of as a system which automates business processes. Typically a BPM system will have a graphical interface which allows you to model your business processes visually so that a business analyst or other non-programmer can easily understand them and verify that they indeed reflect the reality of your business.

process.subprocess.document

jBPM is arguably the best-of-breed open source software in this space and has a similar philosophy to Mule when it comes to valuing simplicity and functionality over adhering to cumbersome “standards” such as BPEL.

Mule ESB integrates with , allowing you to send/receive messages to/from a running process. A message from Mule can start or advance a process, the message can be used as a process variable, and a process can send messages to any endpoint in your Mule config.

jbpm_logo

So when might you consider using jBPM with your Mule application?

  • If the execution in your flow has discrete steps and/or multiple paths based on decision criteria, modeling it as a process may help better visualize it.
  • If your business logic is in constant flux, BPM might be a good way to decouple the logic from your integration.
  • If your business logic or processes need to be reviewed or updated by non-programmers, BPM makes that possible.
  • If a flow does not go from start to finish within a few minutes, it’s probably a good candidate for BPM because intermediate process state is persisted so it does not need to be held in memory.
  • If your integration requires human input, BPM lets you add a human step to your process via task management and a web app.
  • If your application needs a step-by-step audit trail, BPM might be a good option because process history is kept in a database.
  • loan.executions

    Mule has had integration with jBPM since around 1.3, but we have recently improved our support for Mule 3.0, including an upgrade to the latest major version of jBPM (4.3), much simplified configuration, and cleaner integration with Mule from your process definition, including custom process elements. For more information, refer to the Mule 3 documentation.

    Process Definition Snippet using custom Mule elements

    
    <!-- Request received from customer --> 
    <mule-receive name="incomingCustomerRequest" 
         endpoint="CustomerRequests" var="customerRequest"> 
      <transition to="sendToCreditAgency" /> 
    </mule-receive> 
    <!-- Send customer info. to credit agency --> 
    <mule-send name="sendToCreditAgency" 
         expr="#{customerRequest.customer}" endpoint="CreditAgency" 
         synchronous="false"> 
      <transition to="waitForCreditAgency" /> 
    </mule-send> 
    <!-- Wait for the customer's credit profile to arrive. --> 
    <mule-receive name="waitForCreditAgency" 
         endpoint="CreditProfiles" var="creditProfile"> 
      <transition to="prepareLoanQuoteRequest" /> 
    </mule-receive>
    <!-- Send the request to one of three banks, depending on the loan 
         amount and customer credit info. --> 
    <decision name="sendToBanks"> 
      <transition to="sendToBigBank"> 
        <condition expr="#{customerRequest.loanAmount >= 20000}" /> 
        <condition expr="#{creditProfile.creditHistory >= 24}" /> 
        <condition expr="#{creditProfile.creditScore >= 5}" /> 
      </transition> 
      <transition to="sendToMediumBank"> 
        <condition expr="#{customerRequest.loanAmount >= 10000}" /> 
        <condition expr="#{creditProfile.creditHistory >= 12}" /> 
        <condition expr="#{creditProfile.creditScore >= 3}" /> 
      </transition> 
      <transition to="sendToSmallBank"> 
        <condition expr="#{creditProfile.creditHistory >= 6}" /> 
    <condition expr="#{creditProfile.creditScore >= 1}" /> 
      </transition> 
      <!-- If the credit info. doesn't meet minimum requirements based 
           on the loan amount, the loan is just denied. --> 
      <transition to="loanDenied" /> 
    </decision> 
    <mule-send name="sendToBigBank" expr="#{loanRequest}" 
         endpoint="BigBank" var="loanQuote" 
         type="org.mule.example.loanbroker.messages.LoanQuote"> 
      <transition to="sendCustomerResponse" /> 
    </mule-send> 
    


    We'd love to hear your opinion on this post


    2 Responses to “Why use jBPM with Mule?”

    1. […] This tutorial shows you why use jbpm with mule: What is BPM and why would you use it with Mule? […]

    2. […] This tutorial shows you why use jbpm with mule. […]