<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3157463510410059386</id><updated>2012-02-16T13:12:53.871-08:00</updated><title type='text'>BPMN 2.0 / Activiti in Action</title><subtitle type='html'>A blog about the Manning book "Activiti in Action: Executable business processes in BPMN 2.0", the Activiti BPMN 2.0 Eclipse Designer, and the Activiti project in general</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tijs Rademakers</name><uri>http://www.blogger.com/profile/17377449002525504433</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-5446278348606931255</id><published>2011-07-03T13:48:00.000-07:00</published><updated>2011-07-03T14:01:49.017-07:00</updated><title type='text'>Activiti Eclipse Designer 5.7.0 release</title><content type='html'>A new version of the Activiti Eclipse Designer has been released, it's version 5.7.0. This new version contains of course a number of bug fixes, but also some cool new edit features. You can now create new diagrams in just a couple of seconds by using the new "add element" functionality. In addition you can change the type of a task or gateway without the need of deleting and adding a new element.&lt;br /&gt;&lt;br /&gt;Because it's difficult to talk about this new functionality using just text, I created a couple of video's. Besides the new functionality, the video's also show the basics of importing a diagram from the Activiti Modeler into the Activiti Designer and how to deploy a process from the Activiti Designer to the Activiti Engine.&lt;br /&gt;&lt;br /&gt;Let's start with modeling a process with the Activiti Modeler and import it into the Activiti Designer.&lt;br /&gt;&lt;br /&gt;&lt;object id="scPlayer" width="600" height="375" type="application/x-shockwave-flash" data="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/a718c950-3a0f-460c-877d-d89e3297bc61/mp4h264player.swf" &gt; &lt;param name="movie" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/a718c950-3a0f-460c-877d-d89e3297bc61/mp4h264player.swf" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/a718c950-3a0f-460c-877d-d89e3297bc61/FirstFrame.jpg&amp;containerwidth=960&amp;containerheight=600&amp;content=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/a718c950-3a0f-460c-877d-d89e3297bc61/ModelAndImportProcess.mp4&amp;blurover=false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="scale" value="showall" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="base" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/a718c950-3a0f-460c-877d-d89e3297bc61/" /&gt;&lt;iframe type="text/html" frameborder="0" scrolling="no" style="overflow:hidden;" src="http://www.screencast.com/users/TijsRademakers/folders/Camtasia/media/a718c950-3a0f-460c-877d-d89e3297bc61/embed" height="375" width="600" &gt;&lt;/iframe&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Now let's design the same loan request process, but now solely using the Activiti Designer and the new quick edit capabilities.&lt;br /&gt;&lt;br /&gt;&lt;object id="scPlayer" width="600" height="375" type="application/x-shockwave-flash" data="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/3d0127f6-6e87-4de5-93bb-457f9ac978a7/mp4h264player.swf" &gt; &lt;param name="movie" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/3d0127f6-6e87-4de5-93bb-457f9ac978a7/mp4h264player.swf" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/3d0127f6-6e87-4de5-93bb-457f9ac978a7/FirstFrame.jpg&amp;containerwidth=960&amp;containerheight=600&amp;content=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/3d0127f6-6e87-4de5-93bb-457f9ac978a7/FastEditActivitiDesigner.mp4&amp;blurover=false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="scale" value="showall" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="base" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/3d0127f6-6e87-4de5-93bb-457f9ac978a7/" /&gt;&lt;iframe type="text/html" frameborder="0" scrolling="no" style="overflow:hidden;" src="http://www.screencast.com/users/TijsRademakers/folders/Camtasia/media/3d0127f6-6e87-4de5-93bb-457f9ac978a7/embed" height="375" width="600" &gt;&lt;/iframe&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;In addition to the quick edit functionality, there's also a new capability of changing the type of a BPMN element. Let's see that in action.&lt;br /&gt;&lt;br /&gt;&lt;object id="scPlayer" width="600" height="375" type="application/x-shockwave-flash" data="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/c4bafe5a-af01-4ef3-b6cf-f2810ba2c6b3/mp4h264player.swf" &gt; &lt;param name="movie" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/c4bafe5a-af01-4ef3-b6cf-f2810ba2c6b3/mp4h264player.swf" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/c4bafe5a-af01-4ef3-b6cf-f2810ba2c6b3/FirstFrame.jpg&amp;containerwidth=960&amp;containerheight=600&amp;content=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/c4bafe5a-af01-4ef3-b6cf-f2810ba2c6b3/FastEditAndChange.mp4&amp;blurover=false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="scale" value="showall" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="base" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/c4bafe5a-af01-4ef3-b6cf-f2810ba2c6b3/" /&gt;&lt;iframe type="text/html" frameborder="0" scrolling="no" style="overflow:hidden;" src="http://www.screencast.com/users/TijsRademakers/folders/Camtasia/media/c4bafe5a-af01-4ef3-b6cf-f2810ba2c6b3/embed" height="375" width="600" &gt;&lt;/iframe&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;And now deploy the loan request process from the Activiti Designer to the Activiti Engine using Activiti Probe.&lt;br /&gt;&lt;br /&gt;&lt;object id="scPlayer" width="600" height="375" type="application/x-shockwave-flash" data="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/1e16fd42-f2dc-4eea-9ff5-21fc61e78368/mp4h264player.swf" &gt; &lt;param name="movie" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/1e16fd42-f2dc-4eea-9ff5-21fc61e78368/mp4h264player.swf" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/1e16fd42-f2dc-4eea-9ff5-21fc61e78368/FirstFrame.jpg&amp;containerwidth=960&amp;containerheight=600&amp;content=http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/1e16fd42-f2dc-4eea-9ff5-21fc61e78368/Deployment.mp4&amp;blurover=false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="scale" value="showall" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;param name="base" value="http://content.screencast.com/users/TijsRademakers/folders/Camtasia/media/1e16fd42-f2dc-4eea-9ff5-21fc61e78368/" /&gt;&lt;iframe type="text/html" frameborder="0" scrolling="no" style="overflow:hidden;" src="http://www.screencast.com/users/TijsRademakers/folders/Camtasia/media/1e16fd42-f2dc-4eea-9ff5-21fc61e78368/embed" height="375" width="600" &gt;&lt;/iframe&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Hope you will enjoy these new capabilities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-5446278348606931255?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/5446278348606931255/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2011/07/activiti-eclipse-designer-570-release.html#comment-form' title='11 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/5446278348606931255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/5446278348606931255'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2011/07/activiti-eclipse-designer-570-release.html' title='Activiti Eclipse Designer 5.7.0 release'/><author><name>Tijs Rademakers</name><uri>http://www.blogger.com/profile/17377449002525504433</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-1582320475046424326</id><published>2011-05-24T01:20:00.000-07:00</published><updated>2011-05-24T01:28:54.914-07:00</updated><title type='text'>Supersize Activiti with Mule ESB and Apache Camel</title><content type='html'>The Activiti Engine provides a powerful Java API that makes it very easy to for example deploy process definitions, implement custom logic and unit test your processes. When you want to connect remotely to the Activiti Engine there's a REST API to communicate with the process engine. But what if you want to start a new process instance by sending a JMS message, or invoke a web service from a BPMN 2.0 process?&lt;br /&gt;&lt;br /&gt;By default, the BPMN 2.0 specification provides support for doing web service calls via a specific web service task. The Activiti Engine also provides support for a web service task, but it may be a bit cumbersome to implement due to the large amount of additional XML elements needed. And this task does only SOAP web service calls, so JMS messages etc.&lt;br /&gt;&lt;br /&gt;Luckily the Activiti community comes to the rescue. In the next release of Activiti you'll see two interesting new Activiti modules, one for &lt;a href="http://mulesoft.org/"&gt;Mule ESB&lt;/a&gt; integration and one for&amp;nbsp;&lt;a href="http://camel.apache.org/"&gt;Apache Camel&lt;/a&gt; integration. A big thumbs up to Esteban (Mule ESB contribution) and Maciek (Apache Camel contribution). But if you already want to play around, just checkout the Activiti source code at &lt;a href="http://svn.codehaus.org/activiti/"&gt;http://svn.codehaus.org/activiti/&lt;/a&gt;. Let's walk through some simple examples to get a good overview of these modules.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Mule ESB&lt;/span&gt;&lt;br /&gt;Let's start with the Mule ESB module. With the Activiti Mule ESB integration we have two options of deployment. Deployment option one is to run both Mule ESB as well as the Activiti Engine in one Spring container and the communication between Mule ESB and the Activiti Engine uses the Activiti Java API. The second deployment option is to run Mule ESB standalone and let Mule ESB communicate with the Activiti Engine through the REST API. The only difference is the Activiti connector, which is defined in the Mule configuration.&lt;br /&gt;&lt;br /&gt;Embedded configuration:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;mule xmlns="http://www.mulesoft.org/schema/mule/core"&lt;br /&gt;    xmlns:activiti="http://www.mulesoft.org/schema/mule/activiti-embedded"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;activiti:connector name="actServer"&lt;br /&gt;    repositoryService-ref="repositoryService"&lt;br /&gt;    runtimeService-ref="runtimeService"&lt;br /&gt;    taskService-ref="taskService"&lt;br /&gt;    historyService-ref="historyService" /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- Rest of the code shown in the next snippets --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/mule&amp;gt;&lt;br /&gt;&lt;/pre&gt;Remote configuration:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp" style="font-family: inherit;"&gt;&amp;lt;mule xmlns="http://www.mulesoft.org/schema/mule/core"&lt;br /&gt;    xmlns:activiti="http://www.mulesoft.org/schema/mule/activiti-remote"  &lt;br /&gt;&lt;br /&gt;  &amp;lt;activiti:connector name="actServer"&lt;br /&gt;    activitiServerURL="http://localhost:8080/activiti-rest/service/"&lt;br /&gt;    username="kermit"&lt;br /&gt;    password="kermit" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/mule&amp;gt;&lt;/pre&gt;The embedded configuration references Spring beans defined in the Activiti Engine Spring configuration for the Mule ESB to communicate with the Activiti Engine. The remote configuration defines the location of the REST API and defines the authentication parameters so the Mule ESB can use the Activiti REST API to talk with the Activiti Engine.&lt;br /&gt;&lt;br /&gt;Okay that's nice, but now let's actually do something with this Activiti connector. Let's start a new process instance of a very simple BPMN 2.0 process from a JMS message. Now we have setup the Activiti connector infrastructure this is really easy.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;jms:activemq-connector name="jmsConnector" brokerURL="tcp://localhost:61616"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;flow name="MuleCreateProcess"&amp;gt;&lt;br /&gt;  &amp;lt;jms:inbound-endpoint queue="in.create" /&amp;gt;&lt;br /&gt;  &amp;lt;logger message="Received message #[payload]" level="INFO" /&amp;gt;&lt;br /&gt;  &amp;lt;activiti:create-process parametersExpression="#[payload]" /&amp;gt;&lt;br /&gt;  &amp;lt;jms:outbound-endpoint queue="out.create" /&amp;gt;&lt;br /&gt;&amp;lt;/flow&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When a message is sent to the in.create queue, the message is first logged with the #[payload] expression. Then the Mule ESB Activiti module is invoked to create a new process instance. In this example, the JMS message is expected to be a MapMessage and the Map is retrieved to get the process parameters with the parametersExpression. To be able to start a process instance, we have to specify a processDefinitionKey property in the MapMessage. The additional properties specified in the MapMessage are all translated to process variables. Finally the process instance gets created and the newly create process instance object is sent to another JMS queue (out.create). This JMS ObjectMessage contains for example the process instance ID that can be used to retrieve things like process variables etc.&lt;br /&gt;&lt;br /&gt;To test this example we need a bit of JMS plumbing code. So if you're interested in running the code example yourself please look at the &lt;a href="https://code.google.com/p/activiti-esb-blog/"&gt;Google code repository&lt;/a&gt;. In addition to creating new process instances, you can also set new process variables, signal a process instance etc. For a full overview you can read the Mule ESB Activiti &lt;a href="http://www.mulesoft.org/activiti-bpm"&gt;documentation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In addition to communicating with the Activiti Engine from the Mule ESB, it's also possible to send messages from a BPMN process to the Mule ESB. This opens up possibilities to send for example JMS messages, or advanced integration logic from a BPMN process. The current implementation is limited to the embedded mode for this piece of functionality, but there's no reason why this can't be expanded to also supporting the standalone or remote setup. Let's look at a simple process containing a Mule send task.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"&lt;br /&gt;  xmlns:activiti="http://activiti.org/bpmn"&lt;br /&gt;  targetNamespace="http://www.bpmnwithactiviti.org"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;process id="helloWorldMule"&amp;gt;&lt;br /&gt;    &amp;lt;startEvent id="theStart" /&amp;gt;&lt;br /&gt;    &amp;lt;sequenceFlow sourceRef="theStart" targetRef="sendMule" /&amp;gt;&lt;br /&gt;    &amp;lt;sendTask id="sendMule" activiti:type="mule"&amp;gt;&lt;br /&gt;      &amp;lt;extensionElements&amp;gt;&lt;br /&gt;       &amp;lt;activiti:field name="endpointUrl"&amp;gt;&lt;br /&gt;         &amp;lt;activiti:string&amp;gt;vm://in&lt;br /&gt;       &amp;lt;/activiti:field&amp;gt;&lt;br /&gt;       &amp;lt;activiti:field name="language"&amp;gt;&lt;br /&gt;         &amp;lt;activiti:string&amp;gt;juel&lt;br /&gt;       &amp;lt;/activiti:field&amp;gt;&lt;br /&gt;       &amp;lt;activiti:field name="payloadExpression"&amp;gt;&lt;br /&gt;         &amp;lt;activiti:expression&amp;gt;${processVariable1}&lt;br /&gt;       &amp;lt;/activiti:field&amp;gt;&lt;br /&gt;       &amp;lt;activiti:field name="resultVariable"&amp;gt;&lt;br /&gt;         &amp;lt;activiti:string&amp;gt;processVariable2&lt;br /&gt;       &amp;lt;/activiti:field&amp;gt;&lt;br /&gt;      &amp;lt;/extensionElements&amp;gt;&lt;br /&gt;    &amp;lt;/sendTask&amp;gt;&lt;br /&gt;    &amp;lt;sequenceFlow sourceRef="sendMule" targetRef="theEnd" /&amp;gt;&lt;br /&gt;    &amp;lt;endEvent id="theEnd" /&amp;gt;&lt;br /&gt;  &amp;lt;/process&amp;gt;&lt;br /&gt;&amp;lt;/definitions&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In this example we sent a message to the in queue of the JVM transport in Mule (which is a JVM messaging component). The message contains the value of the processVariable1 process variable and the response (we use a request-response exchange pattern in the Mule flow configuration) is written to a new process variable named processVariable2. The Mule flow configuration listing to the in JVM queue looks like this.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;flow name="MuleHello"&amp;gt;&lt;br /&gt;  &amp;lt;vm:inbound-endpoint path="in" exchange-pattern="request-response" /&amp;gt;&lt;br /&gt;  &amp;lt;logger message="Received message #[payload]" level="INFO" /&amp;gt;&lt;br /&gt;  &amp;lt;script:transformer&amp;gt;&lt;br /&gt;    &amp;lt;script:script engine="groovy"&amp;gt;return 'world'&lt;br /&gt;  &amp;lt;/script:transformer&amp;gt;&lt;br /&gt;&amp;lt;/flow&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The message is logged and a very simple Groovy script returns a response message with the value of 'world'. This shows how easy it is to send a message from a BPMN process to the Mule ESB and you can imagine that you can implement a lot of powerful integration logic that way. Let's take a look at the Apache Camel implementation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Apache Camel&lt;/span&gt;&lt;br /&gt;What a luxury we have in the Activiti project. Besides the powerful integration with Mule ESB, we have another great and widely used integration framework available to be used: Apache Camel. You understand that both Mule ESB as well as Apache Camel are capable of doing lots of similar integration logic. There are however also enough differences, and we'll highlight some of them by showing some examples.&lt;br /&gt;&lt;br /&gt;One of the first differences is that the Camel integration always runs embedded with the Activiti Engine in the same Spring configuration. So you have to define a Spring XML configuration that includes an Activiti Engine config and a Camel context config. To be able to start new process instances from Camel the deployed process definition key is made available in the Camel context as you can see in the following snippet.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;beans xmlns="http://www.springframework.org/schema/beans"&lt;br /&gt;    xmlns:camel="http://camel.apache.org/schema/spring"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"&amp;gt;&lt;br /&gt;    &amp;lt;property name="brokerURL" value="tcp://localhost:61616" /&amp;gt;&lt;br /&gt;  &amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;bean id="camel" class="org.activiti.camel.CamelBehaviour"&amp;gt;&lt;br /&gt;    &amp;lt;constructor-arg index="0"&amp;gt;&lt;br /&gt;      &amp;lt;list&amp;gt;&lt;br /&gt;        &amp;lt;bean class="org.activiti.camel.SimpleContextProvider"&amp;gt;&lt;br /&gt;          &amp;lt;constructor-arg index="0" value="helloCamelProcess" /&amp;gt;&lt;br /&gt;          &amp;lt;constructor-arg index="1" ref="camelProcess" /&amp;gt;&lt;br /&gt;        &amp;lt;/bean&amp;gt;&lt;br /&gt;      &amp;lt;/list&amp;gt;&lt;br /&gt;    &amp;lt;/constructor-arg&amp;gt;&lt;br /&gt;  &amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;camelContext id="camelProcess" xmlns="http://camel.apache.org/schema/spring"&amp;gt;&lt;br /&gt;    &amp;lt;packageScan&amp;gt;&lt;br /&gt;      &amp;lt;package&amp;gt;org.bpmnwithactiviti.blog.camel&lt;br /&gt;    &amp;lt;/packageScan&amp;gt;&lt;br /&gt;  &amp;lt;/camelContext&amp;gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In this configuration we create a connection to an ActiveMQ broker we'll use later on. Then a SimpleContextProvider is defined that connects a deployed process definition on the Activiti Engine to a Camel context. You can define a list of SimpleContextProviders for each process definition that you want to connect to a Camel context. In the last part a Camel context is defined that scans for RouteBuilder classes in the configured package.&lt;br /&gt;&lt;br /&gt;With the infrastructure in place we can now define integration logic in a Camel RouteBuilder class.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;public class CamelHelloRoute extends RouteBuilder {&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  public void configure() throws Exception {&lt;br /&gt;&lt;br /&gt;    from("activemq:in.create")&lt;br /&gt;        .log(LoggingLevel.INFO, "Received message ${body}")&lt;br /&gt;        .to("activiti:helloCamelProcess")&lt;br /&gt;        .log(LoggingLevel.INFO, "Received message ${body}")&lt;br /&gt;        .to("activemq:out.create");&lt;br /&gt;    &lt;br /&gt;    from("activiti:helloCamelProcess:serviceTask1")&lt;br /&gt;        .log(LoggingLevel.INFO, "Received message on service task ${property.var1}")&lt;br /&gt;        .setProperty("var2").constant("world")&lt;br /&gt;        .setBody().properties();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There are two so-called Camel routes defined in this RouteBuilder class. The first Camel route listens for new messages arriving at the in.create ActiveMQ queue. The message is logged and a new instance of the helloCamelProcess process definition is created and the process instance id is logged and sent to the out.create ActiveMQ queue. So now we can sent a JMS MapMessage to the in.create queue and all entries of the map are set as new process variables on the new process instance of the helloCamelProcess and the process instance id is sent to the out.create queue.&lt;br /&gt;&lt;br /&gt;In the second route the Java service task logic of the helloCamelProcess is implemented (we'll see in a bit how this is implemented in BPMN 2.0 XML). First the process variable var1 is logged and then a new process variable var2 is created on the process instance. Of course we can implement far more complex integration logic here, like sending a JMS message or invoking a web service call.&lt;br /&gt;&lt;br /&gt;Now let's look how the logic of the Java service task (serviceTask1) is delegated to this Camel route.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;definitions targetnamespace="http://www.bpmnwithactiviti.org"&lt;br /&gt;    xmlns:activiti="http://activiti.org/bpmn"&lt;br /&gt;    xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;process id="helloCamelProcess"&amp;gt;&lt;br /&gt;    &amp;lt;startevent id="start"&amp;gt;&lt;br /&gt;    &amp;lt;sequenceflow sourceref="start" targetref="serviceTask1"&amp;gt;&lt;br /&gt;    &amp;lt;servicetask activiti:delegateexpression="${camel}" id="serviceTask1"&amp;gt;&lt;br /&gt;    &amp;lt;sequenceflow sourceref="serviceTask1" targetref="waitState"&amp;gt;&lt;br /&gt;    &amp;lt;receivetask id="waitState"&amp;gt;&lt;br /&gt;    &amp;lt;sequenceflow sourceref="waitState" targetref="theEnd"&amp;gt;&lt;br /&gt;    &amp;lt;endevent id="theEnd"&amp;gt;&lt;br /&gt;  &amp;lt;/process&amp;gt;&lt;br /&gt;&amp;lt;/definitions&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As you can see the Camel route delegation is really simple. We only have to reference the CamelBehavior Spring bean (camel) we defined earlier. In the&amp;nbsp;&lt;a href="https://code.google.com/p/activiti-esb-blog/"&gt;Google code repository&lt;/a&gt; you can find a unit test to run the full example.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;With the availability of both integration modules there is a wide range of integration options that can be leveraged. The BPMN 2.0 specification already supported the web service task, the Activiti Engine added a powerful Java service task, but now the whole range of transports and enterprise integration patterns are available for you to be used. The only limitation is your imagination ;-).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-1582320475046424326?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/1582320475046424326/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2011/05/supersize-activiti-with-mule-esb-and.html#comment-form' title='1 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/1582320475046424326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/1582320475046424326'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2011/05/supersize-activiti-with-mule-esb-and.html' title='Supersize Activiti with Mule ESB and Apache Camel'/><author><name>Tijs Rademakers</name><uri>http://www.blogger.com/profile/17377449002525504433</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-5122999194981231306</id><published>2010-12-04T00:20:00.000-08:00</published><updated>2010-12-05T10:19:28.579-08:00</updated><title type='text'>Activiti Spring integration example</title><content type='html'>A few days ago &lt;a href="http://www.activiti.org/"&gt;Activiti 5.0&lt;/a&gt; was released; an apache licensed clean, fast, rock-solid and easy to use business process management suite. In this post the powerful Spring integration that comes with Activiti is demonstrated with a small example. The Spring integration layer makes the Activiti engine available for use inside a Spring container and provides functionality to invoke Spring beans directly from service tasks and gives you all the Spring comfort with Activiti, like for example dependency injection and transaction support.&lt;br /&gt;&lt;br /&gt;Let's work out an example now to show you how Spring's transaction support can be used together with Activiti and to demonstrate how you can use Spring beans in a BPMN 2.0 process. In the example the in-memory h2 database that is shipped with Activiti, is used to configure Activiti. We will declare a Spring bean in the definition of the BPMN2.XML to perform a service task and next to that another Spring bean, not used by the process itself, that will perform transactional functionality. Within the transaction the bean is using the Activiti API to start a process instance. Take a look at the code to see the bean with the transactional method we want to perform.&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;public class SomeBean {&lt;br /&gt;private RuntimeService runtimeService;&lt;br /&gt;&lt;br /&gt;@Transactional&lt;br /&gt;public void doTransactionalStuff(boolean error){&lt;br /&gt;  runtimeService.startProcessInstanceByKey("springTransactionTest");&lt;br /&gt;  if(error){&lt;br /&gt;    throw new UnsupportedOperationException("Rollback needed!!");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setRuntimeService(RuntimeService runtimeService) {&lt;br /&gt;  this.runtimeService = runtimeService;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As we will see in a bit in the Spring configuration the RuntimeService instance attribute of SomeBean is injected by Spring. The method we are interested in is the doSomeTransactionalStuff method. It takes a boolean error parameter and based on its value it will throw a UnsupportedOperationException or move on after having started a process instance of the springTransactionTest process. The UnsupportedOperationException is a runtime exception that will force Spring to rollback the transaction when it is thrown, ensuring as well that the process instance will not be stored in the Activiti h2 database.&lt;br /&gt;Take a look at the Spring configuration needed to run this example.&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;&amp;lt;beans&gt;&lt;br /&gt;&amp;lt;bean id="dataSource"&lt;br /&gt;    class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"&gt;&lt;br /&gt;  &amp;lt;property name="targetDataSource"&gt;&lt;br /&gt;    &amp;lt;bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource"&gt;&lt;br /&gt;      &amp;lt;property name="driverClass" value="org.h2.Driver" /&gt;&lt;br /&gt;      &amp;lt;property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" /&gt;&lt;br /&gt;      &amp;lt;property name="username" value="sa" /&gt;&lt;br /&gt;      &amp;lt;property name="password" value="" /&gt;&lt;br /&gt;    &amp;lt;/bean&gt;&lt;br /&gt;  &amp;lt;/property&gt;&lt;br /&gt;&amp;lt;/bean&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="txManager"&lt;br /&gt;    class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;&lt;br /&gt;  &amp;lt;property name="dataSource" ref="dataSource" /&gt;&lt;br /&gt;&amp;lt;/bean&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tx:annotation-driven transaction-manager="txManager"/&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"&gt;&lt;br /&gt;  &amp;lt;property name="databaseType" value="h2" /&gt;&lt;br /&gt;  &amp;lt;property name="dataSource" ref="dataSource" /&gt;&lt;br /&gt;  &amp;lt;property name="transactionManager" ref="txManager" /&gt;&lt;br /&gt;  &amp;lt;property name="dbSchemaStrategy" value="create" /&gt;&lt;br /&gt;  &amp;lt;property name="deploymentResources"&lt;br /&gt;      value="classpath*:spring.test.bpmn20.xml" /&gt;&lt;br /&gt;&amp;lt;/bean&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="runtimeService" factory-bean="processEngine"&lt;br /&gt;    factory-method="getRuntimeService" /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="someBean" class="org.activitiinaction.SomeBean"&gt;&lt;br /&gt;  &amp;lt;property name="runtimeService" ref="runtimeService" /&gt;&lt;br /&gt;&amp;lt;/bean&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="someOtherBean" class="org.activitiinaction.SomeOtherBean" /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/beans&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You see the declaration of the in-memory h2 datasource, followed by the declaration of a transaction manager of type DataSourceTransactionManager that is tight to the defined datasource. Then we declare that the transaction manager is annotation driven and define the processEngine and runtimeService beans that will be used in the unit test and in SomeBean. Note that the deploymentResources property is used to point to the location of our example process. Finally the SomeBean is declared getting the runtimeService bean injected in its runtimeService attribute as well as SomeOtherBean, the implementation of the BPMN service task, that will be called by the process. In defining it we are using an Activiti expression.&lt;br /&gt;&lt;br /&gt;SomeOtherBean is just a pojo with one simple method. There is nothing more to it, and it can be directly used in the process.&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;public class SomeOtherBean {&lt;br /&gt;&lt;br /&gt; public void doSimpleStuff(){&lt;br /&gt;  System.out.println("In SomeOtherBean doingSimpleStuff");&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The example process is straightforward. Besides the service task performed by SomeOtherBean, only writing some console output, it contains a single user task just for the reason we mentioned in earlier posts. In order to query the process engine database we need to put the process in a wait state. With only an automated task the process would simply end, so the user task keeps the process instance alive. The whole process declaration is shown below.&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;&amp;lt;definitions&gt;&lt;br /&gt;&amp;lt;process id="springTransactionTest"&gt;&lt;br /&gt;  &amp;lt;sequenceFlow id="sequenceflow1" sourceRef="start"&lt;br /&gt;    targetRef="simple" /&gt;&lt;br /&gt;  &amp;lt;serviceTask id="simple"&lt;br /&gt;    activiti:expression="#{someOtherBean.doSimpleStuff()}" /&gt;&lt;br /&gt;  &amp;lt;sequenceFlow id="sequenceflow2" sourceRef="simple"&lt;br /&gt;    targetRef="userTask" /&gt;&lt;br /&gt;  &amp;lt;userTask id="userTask" /&gt;&lt;br /&gt;  &amp;lt;sequenceFlow id="sequenceflow2" sourceRef="userTask"&lt;br /&gt;    targetRef="end" /&gt;&lt;br /&gt;  &amp;lt;endEvent id="end" name="End" /&gt;&lt;br /&gt;&amp;lt;/process&gt;&lt;br /&gt;&amp;lt;/definitions&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note how Activiti leverages Spring to use the SomeOtherBean instance declared as a Spring bean earlier on. Because we run the Activiti engine within the Spring container, we can directly reference Spring beans from a service task. In the service task doSimpleStuff() is called, in this case, to print a statement to the console.&lt;br /&gt;&lt;br /&gt;In the code needed to test all this we will call upon a SomeBean instance to let it perform some transactional stuff. We call the bean twice. Once with a error value of false and the second call will have an error value of true. Take a look at the code.&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;@RunWith(SpringJUnit4ClassRunner.class)&lt;br /&gt;@ContextConfiguration("classpath:spring-test-application-context.xml")&lt;br /&gt;public class SpringTest {&lt;br /&gt;&lt;br /&gt;@Autowired&lt;br /&gt;private RuntimeService runtimeService;&lt;br /&gt;&lt;br /&gt;@Autowired&lt;br /&gt;private SomeBean someBean;&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;public void simpleProcessTest() {&lt;br /&gt;  try {&lt;br /&gt;    someBean.doTransactionalStuff(false);&lt;br /&gt;    someBean.doTransactionalStuff(true);&lt;br /&gt;  } catch (RuntimeException re) {&lt;br /&gt;    System.out.println("Catching RuntimeException for testing purposes..");&lt;br /&gt;  }&lt;br /&gt;  assertEquals(1, runtimeService.createProcessInstanceQuery().count());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As you can see, the unit test is really simple since we don’t have to create the Activiti engine ourselves. With the standard Spring annotations @RunWith and @ContextConfiguration, the Spring configuration we defined is used as part of this unit test. The @Autowired annotation let's the Spring container inject an instance of the RuntimeService in the test as well as a SomeBean instance.&lt;br /&gt;&lt;br /&gt;When you run the test you will see that two process instances are started. When the SomeBean's doTransactionalStuff() is called with a true value for the error parameter though, SomeBean throws a RuntimeException. This forces Spring to rollback the running transaction and will not commit the process state to the Activiti database. The test makes sure that all this went right, so it checks that indeed only one process instance is returned as the result of the process instance query on the Activiti DB.&lt;br /&gt;&lt;br /&gt;Next time I will post a small example about deploying Activiti in Apache Karaf to show how you can use Activiti in a OSGI container.&lt;br /&gt;&lt;br /&gt;To be complete below follows the pom.xml if you want to create the example yourself:&lt;br /&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;&amp;lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;&lt;br /&gt; &amp;lt;modelVersion&gt;4.0.0&amp;lt;/modelVersion&gt;&lt;br /&gt; &amp;lt;groupId&gt;org.activitiinactioni&amp;lt;/groupId&gt;&lt;br /&gt; &amp;lt;artifactId&gt;Activiti Examples&amp;lt;/artifactId&gt;&lt;br /&gt; &amp;lt;version&gt;0.5-SNAPSHOT&amp;lt;/version&gt;&lt;br /&gt; &amp;lt;packaging&gt;jar&amp;lt;/packaging&gt;&lt;br /&gt; &amp;lt;name&gt;BPMN 2.0 with Activiti - Examples&amp;lt;/name&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;properties&gt;&lt;br /&gt;  &amp;lt;activiti-version&gt;5.0&amp;lt;/activiti-version&gt;&lt;br /&gt;  &amp;lt;spring-version&gt;3.0.3.RELEASE&amp;lt;/spring-version&gt;&lt;br /&gt; &amp;lt;/properties&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;dependencies&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.activiti&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;activiti-engine&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;${activiti-version}&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.activiti&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;activiti-spring&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;${activiti-version}&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;hsqldb&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;hsqldb&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;1.8.0.7&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;com.h2database&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;h2&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;1.2.132&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;      &amp;lt;groupId&gt;org.codehaus.groovy&amp;lt;/groupId&gt;&lt;br /&gt;      &amp;lt;artifactId&gt;groovy&amp;lt;/artifactId&gt;&lt;br /&gt;      &amp;lt;version&gt;1.7.5&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.subethamail&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;subethasmtp&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;3.1.4&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.slf4j&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;slf4j-simple&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;1.6.1&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.hibernate&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;hibernate-entitymanager&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;3.6.0.Final&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.springframework&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;spring-context&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;${spring-version}&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.springframework&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;spring-jdbc&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;${spring-version}&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.springframework&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;spring-tx&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;${spring-version}&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;org.springframework&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;spring-test&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;${spring-version}&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt;  &amp;lt;dependency&gt;&lt;br /&gt;   &amp;lt;groupId&gt;junit&amp;lt;/groupId&gt;&lt;br /&gt;   &amp;lt;artifactId&gt;junit&amp;lt;/artifactId&gt;&lt;br /&gt;   &amp;lt;version&gt;4.8.1&amp;lt;/version&gt;&lt;br /&gt;  &amp;lt;/dependency&gt;&lt;br /&gt; &amp;lt;/dependencies&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;repositories&gt;&lt;br /&gt;  &amp;lt;repository&gt;&lt;br /&gt;   &amp;lt;id&gt;Activiti&amp;lt;/id&gt;&lt;br /&gt;   &amp;lt;url&gt;http://maven.alfresco.com/nexus/content/repositories/activiti&amp;lt;/url&gt;&lt;br /&gt;  &amp;lt;/repository&gt;&lt;br /&gt;  &amp;lt;repository&gt;&lt;br /&gt;   &amp;lt;id&gt;jboss-public-repository-group&amp;lt;/id&gt;&lt;br /&gt;   &amp;lt;name&gt;JBoss Public Maven Repository Group&amp;lt;/name&gt;&lt;br /&gt;   &amp;lt;url&gt;https://repository.jboss.org/nexus/content/groups/public-jboss/&amp;lt;/url&gt;&lt;br /&gt;  &amp;lt;/repository&gt;&lt;br /&gt; &amp;lt;/repositories&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;build&gt;&lt;br /&gt;  &amp;lt;plugins&gt;&lt;br /&gt;   &amp;lt;plugin&gt;&lt;br /&gt;    &amp;lt;groupId&gt;org.apache.maven.plugins&amp;lt;/groupId&gt;&lt;br /&gt;    &amp;lt;artifactId&gt;maven-compiler-plugin&amp;lt;/artifactId&gt;&lt;br /&gt;    &amp;lt;version&gt;2.3.2&amp;lt;/version&gt;&lt;br /&gt;    &amp;lt;configuration&gt;&lt;br /&gt;     &amp;lt;source&gt;1.6&amp;lt;/source&gt;&lt;br /&gt;     &amp;lt;target&gt;1.6&amp;lt;/target&gt;&lt;br /&gt;    &amp;lt;/configuration&gt;&lt;br /&gt;   &amp;lt;/plugin&gt;&lt;br /&gt;  &amp;lt;/plugins&gt;&lt;br /&gt; &amp;lt;/build&gt;&lt;br /&gt;&amp;lt;/project&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-5122999194981231306?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/5122999194981231306/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/12/activiti-spring-integration-example.html#comment-form' title='3 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/5122999194981231306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/5122999194981231306'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/12/activiti-spring-integration-example.html' title='Activiti Spring integration example'/><author><name>Ron van Liempd</name><uri>http://www.blogger.com/profile/01631796125995534145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ZHbztpk2AHE/TKhD7k_7XfI/AAAAAAAAAAM/veLXBJME6Q8/S220/n1369112244_2855_bigger.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-4141457014407010417</id><published>2010-11-07T09:41:00.000-08:00</published><updated>2010-11-07T10:57:01.803-08:00</updated><title type='text'>Using Activiti's email task</title><content type='html'>&lt;div style="text-align: left;"&gt;In a small series of posts we show how to get started with &lt;a href="http://www.activiti.org/"&gt;&lt;span class="Apple-style-span"&gt;Activiti BPMS&lt;/span&gt;&lt;/a&gt; by getting simple processes running on Activiti Engine. Today an Activiti specific construct will be addressed; the email task. To demonstrate this task we build a very small one-step process with Activiti's rc1 release and test it in Eclipse.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before we can do that we need to set up a mail server first. We will use the Apache James project to do that. Download Apache James from &lt;span&gt;&lt;a href="http://james.apache.org/"&gt;http://james.apache.org&lt;/a&gt; and unzip de file in a directory of choice. We are not going to do anything very secure in this example so we will use the default setup. You can start the server by executing the &lt;/span&gt;&lt;span class="CodeChar"&gt;&lt;span&gt;run.sh&lt;/span&gt;&lt;/span&gt;&lt;span&gt; or &lt;/span&gt;&lt;span class="CodeChar"&gt;&lt;span&gt;run.bat&lt;/span&gt;&lt;/span&gt;&lt;span&gt; file in the &lt;/span&gt;&lt;span class="CodeChar"&gt;&lt;span&gt;james_install_dir/bin&lt;/span&gt;&lt;/span&gt;&lt;span&gt; directory.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p class="Body"&gt;After the server is up and running smoothly in the background we need to add a user account so we have somebody to mail to from the process. Start a telnet session with &lt;span class="CodeChar"&gt;&lt;span&gt;localhost&lt;/span&gt;&lt;/span&gt; on port 4555; you can login with the preconfigured &lt;span class="CodeChar"&gt;&lt;span&gt;root&lt;/span&gt;&lt;/span&gt; user, password &lt;span class="CodeChar"&gt;&lt;span&gt;root&lt;/span&gt;&lt;/span&gt;. Then add a user with the following command:&lt;/p&gt;  &lt;p class="Code"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;Adduser miss.piggy piggy&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="Body"&gt;A user called &lt;span class="CodeChar"&gt;&lt;span&gt;miss.piggy&lt;/span&gt;&lt;/span&gt; is added with the email address &lt;span class="CodeChar"&gt;&lt;span&gt;miss.piggy@localhost&lt;/span&gt;&lt;/span&gt; and the password &lt;span class="CodeChar"&gt;&lt;span&gt;piggy&lt;/span&gt;&lt;/span&gt;. To check if Miss Piggy’s account is actually added you can execute the &lt;span class="CodeChar"&gt;&lt;span class="Apple-style-span"&gt;listusers&lt;/span&gt;&lt;/span&gt; command to verify. The screenshot below gives a view on the telnet session to summarize things.&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;img src="http://2.bp.blogspot.com/_ZHbztpk2AHE/TNbn-Gd5hFI/AAAAAAAAACg/5ckHSG-5x5A/s400/SS-2010.11.01-18.34.23.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 248px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5536867845972526162" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;p class="Body"&gt;&lt;span class="Apple-style-span"&gt;That is all there is to it. The James mail server is configured correctly and waiting to receive mails on port 25. Back to Activiti!&lt;/span&gt;&lt;/p&gt;&lt;p class="Body"&gt;&lt;span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;Now that our mail server is up and running smoothly we are ready to declare an email task in the BPMN 2.0 XML file. For the detailed information concerning different configuration options for the email task within Activiti you can check out the Activiti &lt;a href="http://www.activiti.org/userguide/index.html#bpmnEmailTask"&gt;&lt;span class="Apple-style-span"&gt;user guide&lt;/span&gt;&lt;/a&gt;. We will stick to the basics for the moment and create a simple standalone process that sends an email to the customer to test the mail server configuration.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;process id="simpleEmailProcess" &gt;&lt;br /&gt;&amp;lt;startEvent id="theStart" /&gt;&lt;br /&gt;&amp;lt;sequenceFlow sourceRef="theStart" targetRef="sendMail" /&gt;&lt;br /&gt;&amp;lt;serviceTask id="sendMail" activiti:type="mail"&gt;&lt;br /&gt;&amp;lt;extensionElements&gt;&lt;br /&gt;&amp;lt;activiti:field name="to" expression="${recipient}"&lt;br /&gt;&amp;lt;activiti:field name="subject"&gt;       &lt;br /&gt;&amp;lt;activiti:string&gt;Hello ${name}!&lt;br /&gt;&amp;lt;/activiti:field&gt;&lt;br /&gt;&amp;lt;activiti:field name="html"&gt;&lt;br /&gt;&amp;lt;expression&gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt; &amp;lt;html&gt;&lt;br /&gt; &amp;lt;body&gt;&lt;br /&gt;   Hello ${name},&amp;lt;br/&gt;&lt;br /&gt;   Just saying hi!&amp;lt;br/&gt;&lt;br /&gt;   Kind regards,&lt;br /&gt;   Me.&lt;br /&gt; &amp;lt;/body&gt;&lt;br /&gt;&amp;lt;/html&gt;&lt;br /&gt;]]&gt;&lt;br /&gt;&amp;lt;/expression&gt;&lt;br /&gt;&amp;lt;/activiti:field&gt;&lt;br /&gt;&amp;lt;/extensionElements&gt;&lt;br /&gt;&amp;lt;/serviceTask&gt;&lt;br /&gt;&amp;lt;sequenceFlow sourceRef="sendMail" targetRef="theEnd" /&gt;&lt;br /&gt;&amp;lt;endEvent id="theEnd" /&gt;&lt;br /&gt;&amp;lt;/process&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="Body"&gt;&lt;span class="Apple-style-span"&gt;You can now run the process as we have done before within Eclipse, for example with a unit test. Make sure you deploy the BPMN 2.0 XML file correctly in the test and set up a process variables map with the &lt;span class="CodeChar"&gt;name and recipient&lt;/span&gt; variable before you start the process from the code. Take a look at the JavaServiceTaskTest code in &lt;a href="http://bpmn20inaction.blogspot.com/2010/10/bpmn-20-with-activiti-book-order.html"&gt;an earlier blog&lt;/a&gt; if you need a reminder of how to do this. Make sure that the mail server port in the &lt;span class="CodeChar"&gt;activiti.cfg.xml&lt;/span&gt; file is configured for port 25.&lt;/span&gt;&lt;/p&gt;  &lt;p class="Code"&gt;&lt;span class="Apple-style-span"&gt;&lt;mail server="localhost" port="25"&gt;&lt;/mail&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="Code"&gt;&lt;span style="color: black; "&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;When you are done, run the test. After the process is finished you should have received an email in &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;the &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;james_install_dir/apps/james/var/mail/inboxes/miss.piggy&lt;/span&gt;&lt;span style="color: black; "&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt; directory. To view the email you can install an email client like for example Mozilla Thunderbird. James is using the default ports in the standard setup, so you only have to configure Miss Piggy’s account.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_ZHbztpk2AHE/TNb2UWXz9EI/AAAAAAAAADA/UurCD4mPX00/s1600/SS-2010.11.07-19.55.06.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 392px;" src="http://1.bp.blogspot.com/_ZHbztpk2AHE/TNb2UWXz9EI/AAAAAAAAADA/UurCD4mPX00/s400/SS-2010.11.07-19.55.06.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5536883621361873986" /&gt;&lt;/a&gt;&lt;div&gt;That is all there is to it! Next time a look at gateways and event listeners..&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-4141457014407010417?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/4141457014407010417/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/11/using-activitis-email-task.html#comment-form' title='1 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/4141457014407010417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/4141457014407010417'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/11/using-activitis-email-task.html' title='Using Activiti&apos;s email task'/><author><name>Ron van Liempd</name><uri>http://www.blogger.com/profile/01631796125995534145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ZHbztpk2AHE/TKhD7k_7XfI/AAAAAAAAAAM/veLXBJME6Q8/S220/n1369112244_2855_bigger.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_ZHbztpk2AHE/TNbn-Gd5hFI/AAAAAAAAACg/5ckHSG-5x5A/s72-c/SS-2010.11.01-18.34.23.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-537758785892826091</id><published>2010-10-17T09:07:00.000-07:00</published><updated>2010-10-17T13:26:01.696-07:00</updated><title type='text'>BPMN 2.0 with Activiti - book order tutorial (2)</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;i&gt;Step 2 - Adding a start form to the process&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;In a small series of posts we will show how to get started with &lt;a href="http://www.activiti.org/"&gt;Activiti BPMS&lt;/a&gt; by getting a simple book order process running on Activiti Engine. All the BPMN 2.0 constructs that the Activiti Engine currently supports will be addressed in the coming few weeks.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the process model below you can see the Java Service Task that was implemented in &lt;a href="http://bpmn20inaction.blogspot.com/2010/10/bpmn-20-with-activiti-book-order.html"&gt;the previous post&lt;/a&gt;. That time the 'bookTitle' variable was set from within a unit test, today we will add a start form to the process which lets a user fill in a book title in the Activiti Explorer.&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://4.bp.blogspot.com/_ZHbztpk2AHE/TLsg_iFwx-I/AAAAAAAAABk/g7NxglKRXKE/s400/SS-2010.10.17-12.28.42.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 165px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5529049243382237154" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Before we start working with eclipse, to define the process and the form, install Activiti. In this example the &lt;a href="http://www.activiti.org/download.html"&gt;beta 2 release of Activiti&lt;/a&gt; is used. Download it and unzip the file in a directory. Check out the &lt;a href="http://www.activiti.org/userguide/index.html#N10045"&gt;user guide&lt;/a&gt; for more information, but for now it is enough to run the ant demo.setup task to get the engine running. When ant is all done a Tomcat distribution is downloaded and started and the Activiti apps are installed.&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With Tomcat running silently in the background it is time to open eclipse. Since the BPMN 2.0 spec does not specify how task forms should be rendered, forms are defined in the bpmn xml file using Activiti specific constructs. The xml below shows how to add the bookorder.form to the start event in the book order process.&lt;/div&gt;&lt;div&gt;&lt;pre class="brush: csharp"&gt;&amp;lt;process id="bookorder"&gt;&lt;br /&gt; &amp;lt;startEvent id="theStart" activiti:form="bookorder.form"/&gt;&lt;br /&gt; &amp;lt;sequenceFlow id="flow1" sourceRef="theStart"&lt;br /&gt;    targetRef="checkAvailability" /&gt;&lt;br /&gt; &amp;lt;serviceTask id="checkAvailability"&lt;br /&gt;    name="Availability Check"&lt;br /&gt;    activiti:class="org.bpmnwithactiviti.CheckAvailability" /&gt;&lt;br /&gt; &amp;lt;sequenceFlow id="flow2" sourceRef="checkAvailability"&lt;br /&gt;    targetRef="waitState" /&gt;&lt;br /&gt; &amp;lt;receiveTask id="waitState" /&gt;&lt;br /&gt; &amp;lt;sequenceFlow id="flow3" sourceRef="waitState"&lt;br /&gt;    targetRef="theEnd" /&gt;&lt;br /&gt; &amp;lt;endEvent id="theEnd" /&gt;&lt;br /&gt;&amp;lt;/process&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;The task forms that can be rendered by the Activiti Explorer are just plain html files. By convention they have the .form extension. The form that we are going to use is very simple and just has an inputfield to enter the title of the book that we want to order. The variable in the form, in this case the 'bookTitle' variable, will be stored as process variables after completion of the task. The variables must be camel-cased. Currently supported are String, Integer, Boolean and Date, String is the default type.&lt;/div&gt;&lt;div&gt;&lt;pre class="brush:csharp"&gt;&amp;lt;h1&gt;Book Order&amp;lt;/h1&gt;&lt;br /&gt; &amp;lt;table&gt;&lt;br /&gt;   &amp;lt;tr&gt;&lt;br /&gt;     &amp;lt;td&gt;&lt;br /&gt;        &amp;lt;label&gt;Book title:&lt;br /&gt;          &amp;lt;input type="text" name="bookTitle" value="" /&gt;&lt;br /&gt;          &amp;lt;input type="hidden" name="bookTitle_required" value="true" /&gt;&lt;br /&gt;          &amp;lt;input type="hidden" name="bookTitle_type" value="String" /&gt;&lt;br /&gt;        &amp;lt;/label&gt;&lt;br /&gt;     &amp;lt;/td&gt;&lt;br /&gt;   &amp;lt;/tr&gt;&lt;br /&gt; &amp;lt;/table&gt;&lt;/pre&gt;Now that the form and the bpmn xml is ready we can package these files in a business archive, the deployable unit on Activiti Engine. This you can do by exporting the eclipse project with the jar file export wizard. Select only the bpmn xml file and the form and name the file bookorder.bar. To deploy the archive we will create a simple J2SE class with a main method.&lt;/div&gt;&lt;div&gt;&lt;pre class="brush: csharp"&gt;public class BarDeployer {&lt;br /&gt;public static void main(String[] args) throws Exception {&lt;br /&gt;  ProcessEngine processEngine = new ProcessEngineBuilder()&lt;br /&gt;    .configureFromPropertiesResource("activiti.properties")&lt;br /&gt;    .buildProcessEngine();&lt;br /&gt;  RepositoryService repositoryService = processEngine.getRepositoryService();&lt;br /&gt;  String barFileName = "bookorder.bar";&lt;br /&gt;  ZipInputStream inputStream = new ZipInputStream(new FileInputStream(barFileName));&lt;br /&gt;  repositoryService.createDeployment().name(barFileName)&lt;br /&gt;    .addZipInputStream(inputStream).deploy();&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;Note that we now use a different activities.properties file to build the process engine. Since deployment will take place on the Activiti Engine installation running on Tomcat a different config is needed than the one used in our previous unit test.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;Now that the bar file is deployed you can see the installed bookorder process with Activiti Exp&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;lorer on &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;&lt;a href="http://localhost:8080/activiti-explorer/"&gt;http://localhost:8080/activiti-explorer&lt;/a&gt;/. Login as kermit with password kermit &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;and take a look at the processes he can start. On the top of the list you see the Book Order process.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;&lt;/span&gt;&lt;br /&gt;&lt;img src="http://1.bp.blogspot.com/_ZHbztpk2AHE/TLtRiuLFHhI/AAAAAAAAABs/-Roqh5XZ1XM/s400/SS-2010.10.17-21.41.32.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5529102624479321618" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 236px; " /&gt;&lt;/div&gt;&lt;div&gt;Before you can start the process you need to deploy a jar file that contains the CheckAvailability class file in the Tomcat lib directory and restart Tomcat, otherwise the engine can't find the class that implements the Java Service Task we build in the previous post.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that the Action behind the Book Order process is not 'Start Process' but 'Start Form'. Only when we have put in a book title in the form and pressed the 'Ok' button a process instance is created and the 'bookTitle' variable is set.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;&lt;img src="http://4.bp.blogspot.com/_ZHbztpk2AHE/TLtSyiTE-4I/AAAAAAAAAB0/l4YmvQ-Iw1g/s400/SS-2010.10.17-21.47.15.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 154px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5529103995681176450" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;When you submit the form you can see some logging appearing in de Tomcat log file telling you whether the book is available or not. The code of the BookOrder project, including the bar and jar file, can be checked out from the &lt;a href="http://code.google.com/p/bpmn20withactviti/"&gt;Google Code repository&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal; font-size: 16px; "&gt;That was it for now, next time we will take a look at gateways!&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-537758785892826091?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/537758785892826091/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/10/bpmn-20-with-activiti-book-order_17.html#comment-form' title='2 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/537758785892826091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/537758785892826091'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/10/bpmn-20-with-activiti-book-order_17.html' title='BPMN 2.0 with Activiti - book order tutorial (2)'/><author><name>Ron van Liempd</name><uri>http://www.blogger.com/profile/01631796125995534145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ZHbztpk2AHE/TKhD7k_7XfI/AAAAAAAAAAM/veLXBJME6Q8/S220/n1369112244_2855_bigger.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_ZHbztpk2AHE/TLsg_iFwx-I/AAAAAAAAABk/g7NxglKRXKE/s72-c/SS-2010.10.17-12.28.42.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-8634311535825192947</id><published>2010-10-16T22:33:00.001-07:00</published><updated>2010-10-17T13:04:57.120-07:00</updated><title type='text'>BPMN 2.0 with Activiti - book order tutorial</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;i&gt;Step 1 - Implementing a Java Service Task&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;In a small series of posts we will show how to get started with &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;a href="http://www.activiti.org/"&gt;Activiti BPMS&lt;/a&gt; by&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; getting a simple book order process running on Activiti Engine.  All the BPMN 2.0 constructs that the Activiti Engine currently supports will be addressed in the coming few weeks. Today an easy start with the Java Service Task.&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Let's first take a look at the simple version of the bookorder process modeled with the Activiti Modeler tool:&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;img src="http://4.bp.blogspot.com/_ZHbztpk2AHE/TLrP3ZHeZtI/AAAAAAAAABI/VyiK9pOUsSE/s400/SS-2010.10.17-12.28.42.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 165px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5528960043092698834" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;After filling out the title of a book in an order form with Activiti Explorer a process instance is created. Then a &lt;/span&gt;&lt;a href="http://www.activiti.org/userguide/index.html#bpmnJavaServiceTask"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Java Service Task&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; checks if the ordered book is available and depending on the outcome of that check the process routes the order, via an ex&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;clusive gateway&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, to a Groovy Sc&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ript Task&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; to start the shipping process or, when the book turns out to be unavailable, a User Task&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; is created to cancel the order.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Lets take a look at the Java Service Task. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;We will use this task to implement the availability check in our process. The Activiti Engine executes a Java Service task by calling the execute method on a class that implements the &lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ActivitiBehaviour &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;interface. The &lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;CheckAvailability &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;class below does this by extending the &lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;BPMNDelegation&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; convenience class from the Activiti API. In the code you can see that an &lt;/span&gt;&lt;span class="CodeChar"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ActivityBehavior&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; instance &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;has access to the current state of the process through the &lt;/span&gt;&lt;span class="CodeChar"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ActivityExecution &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;that is passed in as a parameter of the &lt;/span&gt;&lt;span class="CodeChar"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;execute &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;method.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;div&gt;&lt;pre class="brush: java"&gt;public class CheckAvailability extends BpmnJavaDelegation {&lt;br /&gt;&lt;br /&gt;public void execute(DelegateExecution execution) {&lt;br /&gt;  String bookTitle = (String) execution.getVariable("bookTitle");&lt;br /&gt;  boolean bookAvailable = false;&lt;br /&gt;  if (bookTitle.equalsIgnoreCase("BPMN 2.0 with Activiti")) {&lt;br /&gt;    bookAvailable = true;&lt;br /&gt;  }&lt;br /&gt;  execution.setVariable("bookAvailable", bookAvailable);&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The execute method takes a process variable from the execution, checks its value and depending on the outcome it sets another variable, called bookAvailable, on the execution. Let's test this with a simple BPMN 2.0 process in eclipse. Take a look at the process below.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="whitespace:pre"&gt;&lt;/span&gt;&lt;pre class="brush: csharp"&gt;&lt;br /&gt;&amp;lt;process id="bookorder"&gt;&lt;br /&gt; &amp;lt;startEvent id="theStart"/&gt;&lt;br /&gt; &amp;lt;sequenceFlow id="flow1" sourceRef="theStart"&lt;br /&gt;     targetRef="checkAvailability" /&gt;&lt;br /&gt; &amp;lt;serviceTask id="checkAvailability" name="Availability Check"&lt;br /&gt;     activiti:class="org.bpmnwithactiviti.CheckAvailability" /&gt;&lt;br /&gt; &amp;lt;sequenceFlow id="flow2" sourceRef="checkAvailability"&lt;br /&gt;     targetRef="waitState" /&gt;&lt;br /&gt; &amp;lt;receiveTask id="waitState" /&gt;&lt;br /&gt; &amp;lt;sequenceFlow id="flow3" sourceRef="waitState" targetRef="theEnd" /&gt;&lt;br /&gt; &amp;lt;endEvent id="theEnd" /&gt;&lt;br /&gt;&amp;lt;/process&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Right after the process will be started the engine reaches the CheckAvailability servicetask, which is implemented by the CheckAvailability class. After execution of the task the engine moves on to the waitstate. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: 15.6px; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;There the engine will give control away, waiting to be signalled by the outside world to move on. We will see later how we can signal a process with for example a user task, for now this task is only there so we can test the values of the '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small; "&gt;bookAvailable' variable. Without the waitstate activity the process would end after execution of the service task and there would be no process to check the variables of to perform the test.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.6px; "&gt;&lt;span class="Apple-style-span" style="font-size: small; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.6px; "&gt;&lt;span class="Apple-style-span" style="font-size: small; "&gt;The ActivitiRule, a convenience class for ProcessEngine and services initialization in the form of a JUnit rule, is used to setup the engine with the activiti-mem.properties file. It will configure the engine with an in-memory H2 database so we can test locally in our eclipse environment. From the ActivitiRule the RuntimeService is retrieved to create an instance of the bookorder process that is deployed thanks to the @Deployment annotation. Later the bookTitle is set after an order form is completed, but in this test we will start the process with a processVariables map containing the booktitle.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;div&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;public class JavaServiceTaskTest {&lt;br /&gt;&lt;br /&gt;@Rule&lt;br /&gt;public ActivitiRule activitiRule = new ActivitiRule("activiti-mem.properties");&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;@Deployment(resources={"bookorder.javaservicetask.bpmn20.xml"})&lt;br /&gt;public void bookAvalaible() {&lt;br /&gt;  Map processVariables = new HashMap();&lt;br /&gt;  processVariables.put("bookTitle", "BPMN 2.0 with Activiti");&lt;br /&gt;  ProcessInstance pi = activitiRule.getRuntimeService()&lt;br /&gt;    .startProcessInstanceByKey("bookorder", processVariables);&lt;br /&gt;  processVariables = activitiRule.getRuntimeService()&lt;br /&gt;    .getVariables(pi.getId());&lt;br /&gt;  assertEquals(true, processVariables.get("bookAvailable"));&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.6px; "&gt;&lt;span class="Apple-style-span" style="font-size: small; "&gt;That is all there is to it. In the next part we will add a form to the process to be able to enter a book title. After the form is added our enhanced process will be packaged in a bar file and deployed to an Activiti Engine instance running on Tomcat so we can start the process from the Activiti Explorer tool.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.6px; "&gt;&lt;span class="Apple-style-span" style="font-size: small; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.6px; "&gt;&lt;span class="Apple-style-span" style="font-size: small; "&gt;That is it for now. The code of the BookOrder project can be checked out from the &lt;a href="http://code.google.com/p/bpmn20withactviti/"&gt;Google Code repository&lt;/a&gt;. There are more usage examples of the Java Service Task there showing how to inject fields in the CheckAvailability class and how to use expression in BPMN to inject these fields dynamically.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-8634311535825192947?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/8634311535825192947/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/10/bpmn-20-with-activiti-book-order.html#comment-form' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/8634311535825192947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/8634311535825192947'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/10/bpmn-20-with-activiti-book-order.html' title='BPMN 2.0 with Activiti - book order tutorial'/><author><name>Ron van Liempd</name><uri>http://www.blogger.com/profile/01631796125995534145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_ZHbztpk2AHE/TKhD7k_7XfI/AAAAAAAAAAM/veLXBJME6Q8/S220/n1369112244_2855_bigger.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_ZHbztpk2AHE/TLrP3ZHeZtI/AAAAAAAAABI/VyiK9pOUsSE/s72-c/SS-2010.10.17-12.28.42.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3157463510410059386.post-255699333956475863</id><published>2010-10-02T06:54:00.000-07:00</published><updated>2010-10-02T06:54:21.233-07:00</updated><title type='text'>Mule 3 released</title><content type='html'>It maybe a bit strange to start of this blog with a post about Mule, but the release of &lt;a href="http://blogs.mulesoft.org/say-hello-to-mule-3/"&gt;version 3.0&lt;/a&gt; of the Mule community edition is certainly a valid reason.&lt;br /&gt;&lt;br /&gt;It's been a while since I wrote the book &lt;a href="http://www.manning.com/rademakers"&gt;Open-source ESBs in Action&lt;/a&gt; with Jos Dirksen. But the coverage of Mule in that book was based on Mule 2.x, which was the current version until a few weeks. In the last couple of years other open source integration frameworks like &lt;a href="http://camel.apache.org/"&gt;Apache Camel&lt;/a&gt;&amp;nbsp;and &lt;a href="http://www.springsource.org/spring-integration"&gt;Spring Integration&lt;/a&gt;&amp;nbsp;came along and provided similar functionality. With&amp;nbsp;version 3.0 Mule&amp;nbsp;steps up again and provides great additional functionality with foremost the following features: hot deployment, new flow based architecture, annotation support and better support for web services and rest.&lt;br /&gt;&lt;br /&gt;I want to highlight two features of&amp;nbsp;Mule 3.0 in this post, which are the new flow based architecture and hot deployment. Previous versions of Mule had a service based architecture to implement your integration logic. The following picture taken from the &lt;a href="http://www.mulesoft.org/documentation/display/MULE3USER/Services"&gt;Mule userguide&lt;/a&gt;&amp;nbsp;describes it in a very easy manner.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_jo5cuWU2IV0/TKb5RPg_bnI/AAAAAAAAABU/GxpVfvT-r5c/s1600/mule_service_architecture.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="77" px="true" src="http://1.bp.blogspot.com/_jo5cuWU2IV0/TKb5RPg_bnI/AAAAAAAAABU/GxpVfvT-r5c/s320/mule_service_architecture.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;As the picture shows, integration logic was implemented via an inbound router to process incoming messages, via a service component to implement additional processing logic, and an outbound router for sending the message along the path. In XML this looked liked the following snippet:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&amp;lt;service name="hello"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;inbound&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;jms:inbound-endpoint queue="hello.in"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;/inbound&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;component class="org.mule.TestComponent"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;outbound&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;pass-through-router&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;jms:outbound-endpoint queue="hello.out"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/pass-through-router&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;/outbound&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;/service&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Nothing wrong with this kind of architecture, but it becomes a bit tricky when you have to specify all kinds of transfers, multiple component classes etc. The new flow based architecture solves these issues and provides a very clean and flexible architecture based on message processors and sources&amp;nbsp;to implement your integration logic (see the following figure taken from the &lt;a href="http://www.mulesoft.org/documentation/display/MULE3USER/Flows"&gt;userguide&lt;/a&gt;).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_jo5cuWU2IV0/TKb9GNv9eeI/AAAAAAAAABY/30d7UfO7LPg/s1600/mule_flow_architecture.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" px="true" src="http://4.bp.blogspot.com/_jo5cuWU2IV0/TKb9GNv9eeI/AAAAAAAAABY/30d7UfO7LPg/s320/mule_flow_architecture.jpg" width="210" /&gt;&lt;/a&gt;&lt;/div&gt;All the things you want to do with a message after it has arrived at a message source is implemented with message processors. So transformers, routers and custom logic are all message processors. This makes it very clean and easier to understand. The new flow based architecture looks like this in XML:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&amp;lt;flow name="hello"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;jms:inbound-endpoint queue="hello.in"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;component class="org.mule.TestComponent"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;nbsp; &amp;lt;jms:outbound-endpoint queue="hello.out"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New;"&gt;&amp;lt;/flow&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;This looks very simple doesn't it? For a very small example like I've implemented here, the differences are not huge of course. But you can imagine that for more complex examples, the new flow based architecture makes your life a lot easier.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The other huge improvement in Mule 3.0 is hot deployment. One of the main differences between &lt;a href="http://servicemix.apache.org/"&gt;Apache ServiceMix&lt;/a&gt;&amp;nbsp;and Mule when we wrote the Open-source ESBs in Action book was a&amp;nbsp;hot deployment feature from an enterprise perspective. And now with version 3.0 it's there and looks very promissing. In the apps directory of the Mule installation you can now deploy a Mule configuration and JARs (if necessary) and Mule picks it up automatically. Then, if you want to change the Mule configuration you can simply update the file and again Mule picks it up automatically. For more information you can look at the &lt;a href="http://www.mulesoft.org/documentation/display/MULE3USER/Hot+Deployment"&gt;userguide&lt;/a&gt;. Hot deployment now works for a lot of implementations, but there is still some room for improvement. For example, only the main Mule configuration file is monitored by Mule, not its child Mule configurations. When compared to other open source ESBs like Apache ServiceMix and Open ESB,&amp;nbsp;I see that Mule takes&amp;nbsp;a web application like approach to hot deployment, where the others use OSGi.&lt;br /&gt;&lt;br /&gt;So to summarize, version 3.0 is certainly a step&amp;nbsp;forward! It provides a lot of improvements and some great new features including the discussed hot deployment and the new flow based architecture. And from a perspective of the &lt;a href="http://www.activiti.org/"&gt;open source BPM Activiti project&lt;/a&gt;&amp;nbsp;I'm enthousiastic about the possibilities of integration between Mule and Activiti. So I hope to see Activiti integration in the next 3.x version of Mule.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3157463510410059386-255699333956475863?l=bpmn20inaction.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bpmn20inaction.blogspot.com/feeds/255699333956475863/comments/default' title='Reacties plaatsen'/><link rel='replies' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/10/mule-3-released.html#comment-form' title='0 reacties'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/255699333956475863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3157463510410059386/posts/default/255699333956475863'/><link rel='alternate' type='text/html' href='http://bpmn20inaction.blogspot.com/2010/10/mule-3-released.html' title='Mule 3 released'/><author><name>Tijs Rademakers</name><uri>http://www.blogger.com/profile/17377449002525504433</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_jo5cuWU2IV0/TKb5RPg_bnI/AAAAAAAAABU/GxpVfvT-r5c/s72-c/mule_service_architecture.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
