<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stephen J. Houston &#187; JBPM</title>
	<atom:link href="http://www.stephenhouston.com/category/jbpm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stephenhouston.com</link>
	<description>Just another J2EE developer</description>
	<lastBuildDate>Mon, 09 Mar 2009 08:45:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JBoss Portal and overwrite-workflow</title>
		<link>http://www.stephenhouston.com/20081006/jboss-portal-and-overwrite-workflow/</link>
		<comments>http://www.stephenhouston.com/20081006/jboss-portal-and-overwrite-workflow/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 07:22:14 +0000</pubDate>
		<dc:creator>Stephen Houston</dc:creator>
				<category><![CDATA[JBPM]]></category>
		<category><![CDATA[JBoss Portal]]></category>

		<guid isPermaLink="false">http://www.stephenhouston.com/?p=4</guid>
		<description><![CDATA[The importance of overwrite-workflow in deploying new process definition versions to JBPM in JBoss Portal]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working on a custom workflow for user registration in JBoss Portal server. This is an area that is lacking in the otherwise adequate JBoss documentation, and has some quirks that confused me and lead to quite a bit of time researching how its implemented to better understand how to make it work. I hope to cover more of the particulars of the jbpm integration in Portal, culminating in a tutorial on how to create a custom user registration process.</p>
<p>But back to the importance of the <span class="code">overwrite-worfklow</span> element in <span class="code">identity-ui-configuration.xml</span>. By default when you first add a new process xml file to the <span class="code">/jboss-portal-ha.sar/portal-identity.sar/con/processes</span> directory, it will be picked up by the portal server on its next restart and loaded into its jbpm database. This can lead you to believe that if the portal server is smart enough to recognize a new process has been deployed then it will be smart enough to recognize that the process has been updated too. Therefore simply overwriting the process definition file will upload a new definition to the database right?</p>
<p>Wrong. Unfortunately the server can only detect new process definition files in that directory, and won&#8217;t examine existing ones to look for changes. To have the portal server update existing processes that have already been deployed you must set <span class="code">overwrite-workflow</span> to <span class="code">true</span>. However as described in the documentation overwrite-workflow does not function just quite how you might like.</p>
<div class="code">overwrite-workflow: overwrites existing process definitions</div>
<p>As it states, it overwrites existing process definitions, but that means that it will deploy new versions of all the process definitions that exist rather than examining them and determining which of them really need to be updated. So even if your process definition has not changed, it will deploy a new version.</p>
<p>Of course this may not matter as jbpm versions all the process definitions in the database, and any suspended or inflight process instances continue to run using the version of the process definition that they started with. Production instances of portal are (hopefully) rarely restarted and therefore will rarely deploy new process instances. But there are a couple of gotchas to watch out for.</p>
<p>Portal is frequently restarted during the development phase, often several times a day. This can lead to the jbpm database quickly having many versions of all the process definitions, which in turn can lead to some interesting problems trying to debug issues as it may not be possible to easily relate a process instance to a process definition xml file. This problem will be worsened if the portal database is shared between several developers.</p>
<p>In production, Portal is often clustered. If <span class="code">overwrite-workflow</span> is set to <span class="code">true</span> on all the portal instances then new definition versions will be deployed when each of the portal instances are restarted. This could quickly become a problem if there are many instances or if the portal server needs to be restarted outside of planned maintenance windows. In production there could well be a large number of running process instances that may need to be related back to a particular version for diagnostic purposes.</p>
<h3>What can be done?</h3>
<p>The simplest solution is to set <span class="code">overwrite-workflow</span> to <span class="code">true</span> only when you actually have new versions of the process definition files to deploy. The downsides of this approach are that it will deploy new versions of all the processes found in the directory, regardless of whether or not they have changed, and that you must remember to keep toggling the switch on and off.</p>
<p>For clustered production nodes, I recommend that during an upgrade process one instance is taken down and used to update the process definitions. After which the setting is immediately set to <span class="code">false</span> again. The same configuration file can be used on all the instances, as its only ever modified briefly during the upgrade of one portal server instance. It should be noted though that if your new definition requires some updated code that you are also deploying, you may well need to take down all of the instances.</p>
<h3>Summary</h3>
<p>In brief, the original problem was that JBoss portal does not pick up updated instances of jbpm process definitions in the <span class="code">/jboss-portal-ha.sar/portal-identity.sar/conf/processes</span> directory. It will only detect process definition files there the first time they are copied there. Subsequent updates to those files will not be deployed.</p>
<p>A workaround/correction to this issue is to set <span class="code">overwrite-workflow</span> to <span class="code">true</span> in <span class="code">identity-ui-configuration.xml</span>. However this has the side-effects of redeploying all the process definitions in the directory, and continuing to redeploy them each time the portal is restarted, potentially leading to a large number of process definition versions in the database.</p>
<hr /><small>Copyright &copy; 2009<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> c1c694ecf7b1a1f6c941688692febd22)</small>]]></content:encoded>
			<wfw:commentRss>http://www.stephenhouston.com/20081006/jboss-portal-and-overwrite-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
