Tuesday, 21 May 2013

Activiti Mule Integartion

Here We are Going Some Good Stuff with Activiti With Mule ESB Integration


 


What You Need ?


·       Activiti 5.12.1


·       MuleStudio-CE-for-win-32bit-1.3.1-201209061215


·       You Need Activiti Explorer Running in Your Tomcat 8080 Port


·       You Need Activiti Rest Running In Your Tomcat 8080 Port


·       Make Sure Your Activiti Explorer and Activiti rest Has to Lead with Same Database


·       Your ActiveMQ has to run in default port.


 


Here We are Doing Integration as Standalone that means Your Mule Instance and Activiti instance Will be Run At Different Web server.


 


 


 


 


 


Now Come In to Mule Studio Side


Step1:


Create Mule Project in Mule Studio


Step2:


Add Mule Flow in This Project


Step 3:


Create Mule Flow With Following Contains.


 


<?xml version="1.0" encoding="UTF-8"?>


 


<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:http="http://www.mulesoft.org/schema/mule/http"


      xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:json="http://www.mulesoft.org/schema/mule/json"


      xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:file="http://www.mulesoft.org/schema/mule/file"


      xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core"


      xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"


      xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.3.0"


      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://www.mulesoft.org/schema/mule/activiti-remote"


      xmlns:script="http://www.mulesoft.org/schema/mule/scripting"


      xsi:schemaLocation="


http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd


http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd


http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd


http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd


http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd


http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd


http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd


http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd


http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd


http://www.mulesoft.org/schema/mule/activiti-remote http://www.mulesoft.org/schema/mule/activiti-remote/3.2/mule-activiti-remote.xsd


http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd ">


      <activiti:connector name="actServer"


            activitiServerURL="http://localhost:8080/activiti-rest/service/"


            username="kermit" password="kermit" />


 


      <jms:activemq-connector name="jmsConnector"


            brokerURL="tcp://localhost:61616" doc:name="Active MQ" />


 


      <flow name="MuleCreateProcess" doc:name="MuleCreateProcess">


            <jms:inbound-endpoint queue="in.create" doc:name="JMS" />


            <logger message="Received message  is******************* #[payload]"


                  level="INFO" doc:name="Logger" />


 


            <scripting:transformer doc:name="Script">


 


                  <scripting:script engine="groovy">


                 


                   Map map = new HashMap()


                map.put("processDefinitionKey", payload)


                 return map


                  </scripting:script>


 


            </scripting:transformer>


        <logger level="INFO" doc:name="Logger" message="After Received message  is******************* #[payload]"/>


            <activiti:create-process parametersExpression="#[payload]" />


            <jms:outbound-endpoint queue="out.create"


                  doc:name="JMS" />


      </flow>


 


 


 


</mule>


 


 


 


 


 


Step 4:


Here we are Using ActiveMQ for message Exchanging. So you need to have Apache ActiveMQ running on the same Instance.


 


Step5:


Run Your Mule Flow as Mule Application


Step 6:


 go to ActiveMQ Console as localhost:8161/admin


Step 7:


 Go to Queue And Select Your Queue Name what we have set in Mule Flow, Pass your Process id Which we have Deployed in our Activiti Explorer,


 


Ste 8:


once you send message, automatically your Process will be Start in Your Activiti Explorer.

2 comments:

  1. hello,

    I have tried to test your mule sample, but it's complaining about activiti namespaces.

    org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.mulesoft.org/schema/mule/activiti-remote/3.2/mule-activiti-remote.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

    ReplyDelete
  2. hi, i got the same problem.

    ERROR 2014-01-14 15:16:33,248 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.mulesoft.org/schema/mule/activiti-remote]
    Offending resource: URL [file:/home/wfamaya/mulews/.mule/apps/activiti/activiti.xml]

    ReplyDelete