<?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>MoDoFo.println(" &#187; jBPM</title>
	<atom:link href="http://zhangv.com/archives/tag/jbpm/feed" rel="self" type="application/rss+xml" />
	<link>http://zhangv.com</link>
	<description>Life for Idea - forever young</description>
	<lastBuildDate>Sat, 07 Apr 2012 04:08:37 +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>jPDL和XUL结合</title>
		<link>http://zhangv.com/archives/580</link>
		<comments>http://zhangv.com/archives/580#comments</comments>
		<pubDate>Tue, 25 Nov 2008 03:37:13 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[Idea]]></category>
		<category><![CDATA[jBPM]]></category>
		<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://zhangv.com/archives/580</guid>
		<description><![CDATA[之前用jPDL时候有一个头疼的地方是界面的整合开发。jPDL designer可以生成jsf的界面（但因为对jsf的敬畏而没有去进一步考证），后来看到liferay里的一种做法是给任务节点上定义一些页面元素，比如 username:text, password:password, gender:checkbox(M,F)...记得不太清楚了，但是意思就是把一些关于界面的参数放到流程定义里，再通过工具来生成相应的页面。思路比较清楚，也比较简单。
后来了解了一些XUL的东西，觉得似乎这些界面参数也可以用XUL来定义，相对标准化一点，而且也容易扩展。标准化的优点就是每个人都可以写自己的XUL解析和界面生成引擎，或者有统一的引擎可以用。
先YY记录下来。

	Tags: Idea, jBPM, xul
]]></description>
			<content:encoded><![CDATA[<p>之前用jPDL时候有一个头疼的地方是界面的整合开发。jPDL designer可以生成jsf的界面（但因为对jsf的敬畏而没有去进一步考证），后来看到liferay里的一种做法是给任务节点上定义一些页面元素，比如 username:text, password:password, gender:checkbox(M,F)...记得不太清楚了，但是意思就是把一些关于界面的参数放到流程定义里，再通过工具来生成相应的页面。<br />思路比较清楚，也比较简单。</p>
<p>后来了解了一些XUL的东西，觉得似乎这些界面参数也可以用XUL来定义，相对标准化一点，而且也容易扩展。标准化的优点就是每个人都可以写自己的XUL解析和界面生成引擎，或者有统一的引擎可以用。</p>
<p>先YY记录下来。</p>

	Tags: <a href="http://zhangv.com/archives/tag/idea" title="Idea" rel="tag">Idea</a>, <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a>, <a href="http://zhangv.com/archives/tag/xul" title="xul" rel="tag">xul</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/580/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>seven forms of bpm &#8211; after read</title>
		<link>http://zhangv.com/archives/551</link>
		<comments>http://zhangv.com/archives/551#comments</comments>
		<pubDate>Thu, 16 Oct 2008 11:19:10 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[bpm]]></category>
		<category><![CDATA[jBPM]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://zhangv.com/archives/551</guid>
		<description><![CDATA[seven forms of bpm - after read
use case 1:bpm as a disciplinerefers to the analysis, documentation and improvement of the procedures thatdescribe how people and systems work together in an organization.In the context of BPM as a discipline, we believe that a process modelfrom a non technical business analyst can never be translated into an [...]]]></description>
			<content:encoded><![CDATA[<p>seven forms of bpm - after read</p>
<p>use case 1:bpm as a discipline<br />refers to the analysis, documentation and improvement of the procedures that<br />describe how people and systems work together in an organization.<br />In the context of BPM as a discipline, we believe that a process model<br />from a non technical business analyst can never be translated into an executable process model by<br />just adding technical details to it.<br />Who is going to spend the time to link the<br />analysis blocks to the executable blocks and then keep that mapping up to date.<br />jBPM's jPDL language is designed to facilitate this approach. First of all, it's based on free graph<br />modeling. Secondly, it has so called actions, which can be seen as event listeners.<br />This allows the developer to add programming logic without<br />changing the diagram structure.<br />Also super-states are often used in the context of creating better<br />communication between business analyst and developer.</p>
<p>Use Case 2 : Combining template based and ad hoc task management<br />But what<br />is often overlooked is that template based task orchestration only suits for a limited number of<br />scenarios.<br />First the process must be relatively stable. And secondly, enough executions of this<br />process have to happen so that the gain that can be achieved with software support is worth the<br />development effort.<br />In jBPM 4, the task management component will support this ad hoc human tasks. The<br />combination will be awsome. Human tasks in processes can be specified at a course grained level.</p>
<p>Use case 3 : Transactional asynchronous architectures<br />BPEL also focuses on asynchronous architectures, but then in a (web) services environment, rather<br />then a Java environment.<br />From the history<br />information it is very easy to collect valuable statistical information like the average time in each<br />step of the process.</p>
<p>Use case 4 : Service orchestration<br />Service orchestration is actually a variant of the previous use case 'transactional asynchronous<br />architectures'.</p>
<p>Use Case 5 : Visual programming<br />With visual programming, we will target developers that do not yet have the full skillset to develop<br />in Java.<br />But visual<br />programming can lower the treshold to build applications for developers that have no or limited<br />Java knowledge.</p>
<p>Use Case 6 : Thread Control Language<br />We'll develop a Thread Control Language which lets you specify a multithreaded Java concurrency<br />by drawing forks, joins and method activities.</p>
<p>Use Case 7 : Easy creation of DSLs<br />General purpose process languages are different from domain specific process languages.<br />There is even an easier way. Instead of creating a full process language for a specific purpose, it is<br />also possible to leverage jPDL's capabilities and just add new node types to it.</p>

	Tags: <a href="http://zhangv.com/archives/tag/bpm" title="bpm" rel="tag">bpm</a>, <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a>, <a href="http://zhangv.com/archives/tag/workflow" title="workflow" rel="tag">workflow</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/551/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[源码研究]jbpm中的异步Action</title>
		<link>http://zhangv.com/archives/184</link>
		<comments>http://zhangv.com/archives/184#comments</comments>
		<pubDate>Tue, 15 Apr 2008 07:16:48 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[jBPM]]></category>
		<category><![CDATA[源码研究]]></category>

		<guid isPermaLink="false">http://zhangv.com/?p=184</guid>
		<description><![CDATA[在jbpm中,如果action可以配置为异步执行
&#60;action class="ActionClassName" async="true"&#62;&#60;/action&#62;
如果是异步action,那么在flow执行到action所依附的节点时,会保存一个job,然后交由单独的job执行线程处理.源代
码:
GraphElement.java的executeActions方法:
if (action.isAsync()) {
ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(), action);
MessageService messageService = (MessageService) Services.getCurrentService
(Services.SERVICENAME_MESSAGE);
messageService.send(job);
} else {
executeAction(action, executionContext);
}
这个job保存到数据库,并由JobExecutor去执行.
而jobExecutor在默认情况下是不会被启用的,需要手动启用或者配置为自动启动的servlet(JobExecutorServlet).
手动启动通过这个方法:
JbpmConfiguration.startJobExecutor()
还需要做的工作,在jbpm.cfg.xml里定义一个jobExecutor
&#60;bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor" singleton="true" /&#62;
如果不用JbpmConfiguration应该也可以启动.做的事都是一样的,创建一个新的JobExecutor然后启动线程.只是猜测,没试过.
在3.1的数据库里是没有job的表的,升级到3.2.2后才有这个表.

	Tags: jBPM, 源码研究
]]></description>
			<content:encoded><![CDATA[<p>在jbpm中,如果action可以配置为异步执行</p>
<p>&lt;action class="ActionClassName" <strong>async="true"</strong>&gt;&lt;/action&gt;</p>
<p>如果是异步action,那么在flow执行到action所依附的节点时,会保存一个job,然后交由单独的job执行线程处理.源代</p>
<p>码:<br />
GraphElement.java的executeActions方法:</p>
<p>if (action.isAsync()) {<br />
ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(), action);<br />
MessageService messageService = (MessageService) Services.getCurrentService</p>
<p>(Services.SERVICENAME_MESSAGE);<br />
messageService.send(job);<br />
} else {<br />
executeAction(action, executionContext);<br />
}</p>
<p>这个job保存到数据库,并由JobExecutor去执行.</p>
<p>而jobExecutor在默认情况下是不会被启用的,需要手动启用或者配置为自动启动的servlet(JobExecutorServlet).<br />
手动启动通过这个方法:</p>
<p>JbpmConfiguration.startJobExecutor()</p>
<p>还需要做的工作,在jbpm.cfg.xml里定义一个jobExecutor</p>
<p>&lt;bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor" singleton="true" /&gt;</p>
<p>如果不用JbpmConfiguration应该也可以启动.做的事都是一样的,创建一个新的JobExecutor然后启动线程.只是猜测,没试过.</p>
<p>在3.1的数据库里是没有job的表的,升级到3.2.2后才有这个表.</p>

	Tags: <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a>, <a href="http://zhangv.com/archives/tag/%e6%ba%90%e7%a0%81%e7%a0%94%e7%a9%b6" title="源码研究" rel="tag">源码研究</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/184/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用springmodules启动子流程的问题</title>
		<link>http://zhangv.com/archives/174</link>
		<comments>http://zhangv.com/archives/174#comments</comments>
		<pubDate>Wed, 02 Apr 2008 15:37:44 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[jBPM]]></category>

		<guid isPermaLink="false">http://zhangv.wordpress.com/?p=249</guid>
		<description><![CDATA[



今天在整合jbpm时遇到这样一个错误can‘t create process instance when processdefinition is null
因为使用了subprocess,跟进源代码看了一下:(我用的是springmodules整合jbpm和spring)
发现子流程实例无法创建,因为没有context(JbpmContext).问题最终归结在怎样启动流程实例.原来的做法是:
ProcessDefinition pd = jbpmTemplate.getProcessDefinition();
ProcessInstance pi = new ProcessInstance(pd,variables);
pi.getRootToken().signal();
这样启动,如果没有子流程是没问题的.但是如果有了子流程,ProcessState(子流程state)会通过当前JbpmContext
去启动子流程.而上面这种做法是没有JbpmContext的!正确的做法是:
jbpmTemplate.execute(new JbpmCallback(){
public Object doInJbpm(JbpmContext context) throws JbpmException {
HashMap&#60;String,Object&#62; variables = new HashMap&#60;String, Object&#62;();
ProcessInstance pi = new ProcessInstance(jbpmTemplate.getProcessDefinition()
,variables);
pi.getRootToken().signal();
return null;
}
});
这种做法会初始化一个新的context然后启动流程.问题解决.但要注意设置subprocess的属性binding=”late”.如下:
&#60;process-state name=”V3-sub-process” &#62;
&#60;sub-process name=”V3″ binding=”late”&#62;&#60;/sub-process&#62;
&#60;variable access=”read,write” name=”objType”&#62;&#60;/variable&#62;
&#60;variable access=”read,write” name=”objId”&#62;&#60;/variable&#62;
&#60;transition to=”tradeMatch”&#62;&#60;/transition&#62;
&#60;/process-state&#62;
意味着subprocess不是在初始化父流程时就初始化(findSubprocess),而是在processState.execute时候才初始化(这个时候才有context).如果不加binding=”late”,还是会有同样的错误.
另:在网上找解决方法时候发现,这个issue.貌似目前springmodules0.8不支持context外包含子流程的流程实例创建.所以做法应该是没错的.check过了,0.9也没有支持





	Tags: jBPM
]]></description>
			<content:encoded><![CDATA[<div class="entry-body">
<div>
<div class="item-body">
<div>
<p>今天在整合jbpm时遇到这样一个错误can‘t create process instance when processdefinition is null<br />
因为使用了subprocess,跟进源代码看了一下:(我用的是springmodules整合jbpm和spring)</p>
<p>发现子流程实例无法创建,因为没有context(JbpmContext).问题最终归结在怎样启动流程实例.原来的做法是:</p>
<p>ProcessDefinition pd = jbpmTemplate.getProcessDefinition();<br />
ProcessInstance pi = new ProcessInstance(pd,variables);<br />
pi.getRootToken().signal();</p>
<p>这样启动,如果没有子流程是没问题的.但是如果有了子流程,ProcessState(子流程state)会通过当前JbpmContext<br />
去启动子流程.而上面这种做法是没有JbpmContext的!正确的做法是:</p>
<p>jbpmTemplate.execute(new JbpmCallback(){<br />
public Object doInJbpm(JbpmContext context) throws JbpmException {<br />
HashMap&lt;String,Object&gt; variables = new HashMap&lt;String, Object&gt;();<br />
ProcessInstance pi = new ProcessInstance(jbpmTemplate.getProcessDefinition()<br />
,variables);<br />
pi.getRootToken().signal();<br />
return null;<br />
}<br />
});</p>
<p>这种做法会初始化一个新的context然后启动流程.问题解决.但要注意设置subprocess的属性binding=”late”.如下:</p>
<p>&lt;process-state name=”V3-sub-process” &gt;<br />
&lt;sub-process name=”V3″ <strong>binding=”late”</strong>&gt;&lt;/sub-process&gt;<br />
&lt;variable access=”read,write” name=”objType”&gt;&lt;/variable&gt;<br />
&lt;variable access=”read,write” name=”objId”&gt;&lt;/variable&gt;<br />
&lt;transition to=”tradeMatch”&gt;&lt;/transition&gt;<br />
&lt;/process-state&gt;</p>
<p>意味着subprocess不是在初始化父流程时就初始化(findSubprocess),而是在processState.execute时候才初始化(这个时候才有context).如果不加binding=”late”,还是会有同样的错误.</p>
<p>另:在网上找解决方法时候发现,这个<a href="http://jira.springframework.org/browse/MOD-422" target="_blank">issue</a>.貌似目前springmodules0.8不支持context外包含子流程的流程实例创建.所以做法应该是没错的.check过了,0.9也没有支持</p>
</div>
</div>
</div>
</div>

	Tags: <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/174/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jPDL的扩展思考</title>
		<link>http://zhangv.com/archives/106</link>
		<comments>http://zhangv.com/archives/106#comments</comments>
		<pubDate>Sat, 19 Jan 2008 14:29:59 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[jBPM]]></category>
		<category><![CDATA[工作流]]></category>

		<guid isPermaLink="false">http://218.22.170.60/zhangv/wordpress/?p=144</guid>
		<description><![CDATA[基于自己目前对jBPM的了解，发现使用jBPM做为工作流引擎时流程可以通过jPDL很方便的定义和发布。主要的工作来自于界面的定制，因为觉得 想要做一个通用的jBPM界面简直是不可能（或者是我目前的思路有问题），每个流程的流程meta是没问题，比方说把transition定义为一个 button然后去调用webcontroller，但是业务meta就不行了，某个字段可能需要显示为一个dropdown而不是文本框。尽管jPDL designer可以生成form但也只能生成比较简单的文本框和按钮，而且是基于jsf。
偶然中发现了liferay中对jPDL的扩展恰好是我想要的，增加了表单数据类型的定义
每个node的变量定义为：
text:username
textarea:introduction
checkbox:married:yes,no
“liferay的workflow portlet对jbpm的变量定义经行了扩展，可以看到每个变量的名字都由多部分组成其中用冒号分隔，workflow portlet会根据变量的前缀自动为该变量生成html中的表单。”
现在扩展是扩展了，但是如果想要加入业务规则呢？试试另一种思路：业务数据是在流在工作流上的，那么在不同的流程阶段（phase）要满足不同的业 务规则。这里就有一个问题了，规则是应该作为流程的一部分还是作为数据的一部分，显然应该是流程的一部分。但流程怎么能够知道这些meta（某个数据在某 个节点上要怎么显示并满足哪些规则）呢 ？（其实这些东西早就有现成的产品了。比如PEGA）这个时候就又需要扩展jPDL了。
考虑怎么去扩展jPDL：每个流程应该有一个flowBean的model，他可能包含很多其他的业务数据对象，这样每个流程所要操作的数据就都在 这个flowBean里，而规则和显示则要定义到流程的每个节点。有点类似JPF(java page flow,weblogic portal用的webmvc)。
先想到这里，以后再补充。

	Tags: jBPM, 工作流
]]></description>
			<content:encoded><![CDATA[<p>基于自己目前对jBPM的了解，发现使用jBPM做为工作流引擎时流程可以通过jPDL很方便的定义和发布。主要的工作来自于界面的定制，因为觉得 想要做一个通用的jBPM界面简直是不可能（或者是我目前的思路有问题），每个流程的流程meta是没问题，比方说把transition定义为一个 button然后去调用webcontroller，但是业务meta就不行了，某个字段可能需要显示为一个dropdown而不是文本框。尽管jPDL designer可以生成form但也只能生成比较简单的文本框和按钮，而且是基于jsf。</p>
<p>偶然中发现了liferay中对jPDL的扩展恰好是我想要的，增加了表单数据类型的定义</p>
<p>每个node的变量定义为：<br />
text:username<br />
textarea:introduction<br />
checkbox:married:yes,no</p>
<p><span style="color:black;"></span><span style="color:black;">“liferay</span><span style="color:black;">的</span><span style="color:black;">workflow portlet</span><span style="color:black;">对</span><span style="color:black;">jbpm</span><span style="color:black;">的变量定义经行了扩展，可以看到每个变量的名字都由多部分组成其中用冒号分隔，</span><span style="color:black;">workflow portlet</span><span style="color:black;">会根据变量的前缀自动为该变量生成</span><span style="color:black;">html</span><span style="color:black;">中的表单。”</span></p>
<p>现在扩展是扩展了，但是如果想要加入业务规则呢？试试另一种思路：业务数据是在流在工作流上的，那么在不同的流程阶段（phase）要满足不同的业 务规则。这里就有一个问题了，规则是应该作为流程的一部分还是作为数据的一部分，显然应该是流程的一部分。但流程怎么能够知道这些meta（某个数据在某 个节点上要怎么显示并满足哪些规则）呢 ？（其实这些东西早就有现成的产品了。比如PEGA）这个时候就又需要扩展jPDL了。</p>
<p>考虑怎么去扩展jPDL：每个流程应该有一个flowBean的model，他可能包含很多其他的业务数据对象，这样每个流程所要操作的数据就都在 这个flowBean里，而规则和显示则要定义到流程的每个节点。有点类似JPF(java page flow,weblogic portal用的webmvc)。</p>
<p>先想到这里，以后再补充。</p>

	Tags: <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a>, <a href="http://zhangv.com/archives/tag/%e5%b7%a5%e4%bd%9c%e6%b5%81" title="工作流" rel="tag">工作流</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/106/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jBPM中task的signalling和blocking属性</title>
		<link>http://zhangv.com/archives/94</link>
		<comments>http://zhangv.com/archives/94#comments</comments>
		<pubDate>Sun, 06 Jan 2008 14:31:22 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[jBPM]]></category>

		<guid isPermaLink="false">http://218.22.170.60/zhangv/wordpress/?p=145</guid>
		<description><![CDATA[今天发现在创建一个task实例之后,数据库中会出现两个task记录,不同的只是其中一个的issignaling是r,另一个是null.而且这两个使用的也是同一个token.查看jBPM的手册中的task management发现这样解释的:
A signalling task instance is a task instance that, when completed, can send a signal to its token to continue the process execution. Task instances can be blocking, meaning that the related token (=path of execution) is not allowed to leave the task-node before the task instance is completed. By default task instances are [...]]]></description>
			<content:encoded><![CDATA[<p>今天发现在创建一个task实例之后,数据库中会出现两个task记录,不同的只是其中一个的issignaling是r,另一个是null.而且这两个使用的也是同一个token.查看jBPM的手册中的task management发现这样解释的:</p>
<p>A signalling task instance is a task instance that, when completed, can send a signal to its token to continue the process execution. Task instances can be blocking, meaning that the related token (=path of execution) is not allowed to leave the task-node before the task instance is completed. By default task instances are signalling and non-blocking.</p>
<p>信令和阻塞,当执行完成时发送一个signal给token..而blocking意味着token被阻塞在task-node直到task完成.不理解这个要在什么样的情况下使用,是不是分支任务的时候?</p>
<p>但是还是很奇怪,我这里只是 把start-state的task改成blocking=true就解决问题了.难道和state有关系吗?</p>
<p>有可能是我在生成processInstance时候有问题. 代码如下:</p>
<p>// create a new process instance to run<br />
ProcessInstance processInstance = new ProcessInstance(processDefinition);<br />
// create a new taskinstance for the start task<br />
TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();<br />
//signal<br />
taskInstance.getToken().signal();<br />
context.save(processInstance);</p>
<p>这样会生成两个taskinstance,而且一个是signaling一个是blocking??????</p>

	Tags: <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/94/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jBPM的性能测试</title>
		<link>http://zhangv.com/archives/93</link>
		<comments>http://zhangv.com/archives/93#comments</comments>
		<pubDate>Sat, 05 Jan 2008 14:40:16 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[jBPM]]></category>

		<guid isPermaLink="false">http://218.22.170.60/zhangv/wordpress/?p=154</guid>
		<description><![CDATA[其实也还是hibernate得性能测试.不过为了满足boss的要求,还是写了一个测试.
启动20个线程,每个形成使用JbpmContext生成1000个ProcessInstance,然后遍历每个节点.
测试结果: 每个线程所需时间范围是360 - 420 s
用jconsole看了一下,瓶颈主要在网络读取(jdbc driver的socketread)和连接池等待(waiting available, checkout)上 .
import java.io.FileNotFoundException;
import java.io.IOException;
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.util.Log4jConfigurer;
import org.springmodules.workflow.jbpm31.JbpmCallback;
import org.springmodules.workflow.jbpm31.JbpmTemplate;
import com.jpmchase.zpcclass.common.util.SpringUtils;
import com.jpmchase.zpcclass.workflow.service.WorkFlowService;
public class JbpmScalTest {
static {
SpringUtils.initFromClasspath(new String[]{”com/jpmchase/zpcclass/applicationContext*.xml”});
try {
Log4jConfigurer.initLogging(”classpath:com/jpmchase/zpcclass/log4j.properties”);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
WorkFlowService wfs;
private JbpmTemplate jbpmTemplate;
@Before
public void setUp() throws Exception {
wfs = (WorkFlowService) SpringUtils.getBean(”workFlowService”);
jbpmTemplate = (JbpmTemplate) SpringUtils.getBean(”jbpmTemplate”);
}
@After
public void tearDown() throws Exception {
}
public static void [...]]]></description>
			<content:encoded><![CDATA[<p>其实也还是hibernate得性能测试.不过为了满足boss的要求,还是写了一个测试.</p>
<p>启动20个线程,每个形成使用JbpmContext生成1000个ProcessInstance,然后遍历每个节点.</p>
<p>测试结果: 每个线程所需时间范围是360 - 420 s</p>
<p>用jconsole看了一下,瓶颈主要在网络读取(jdbc driver的socketread)和连接池等待(waiting available, checkout)上 .</p>
<p>import java.io.FileNotFoundException;<br />
import java.io.IOException;</p>
<p>import org.jbpm.JbpmContext;<br />
import org.jbpm.JbpmException;<br />
import org.jbpm.graph.def.ProcessDefinition;<br />
import org.jbpm.graph.exe.ProcessInstance;<br />
import org.jbpm.taskmgmt.exe.TaskInstance;<br />
import org.junit.After;<br />
import org.junit.Before;<br />
import org.junit.Test;<br />
import org.springframework.util.Log4jConfigurer;<br />
import org.springmodules.workflow.jbpm31.JbpmCallback;<br />
import org.springmodules.workflow.jbpm31.JbpmTemplate;</p>
<p>import com.jpmchase.zpcclass.common.util.SpringUtils;<br />
import com.jpmchase.zpcclass.workflow.service.WorkFlowService;</p>
<p>public class JbpmScalTest {<br />
static {<br />
SpringUtils.initFromClasspath(new String[]{”com/jpmchase/zpcclass/applicationContext*.xml”});<br />
try {<br />
Log4jConfigurer.initLogging(”classpath:com/jpmchase/zpcclass/log4j.properties”);<br />
} catch (FileNotFoundException e) {<br />
e.printStackTrace();<br />
}<br />
}<br />
WorkFlowService wfs;<br />
private JbpmTemplate jbpmTemplate;<br />
@Before<br />
public void setUp() throws Exception {<br />
wfs = (WorkFlowService) SpringUtils.getBean(”workFlowService”);<br />
jbpmTemplate = (JbpmTemplate) SpringUtils.getBean(”jbpmTemplate”);<br />
}</p>
<p>@After<br />
public void tearDown() throws Exception {<br />
}</p>
<p>public static void main(String[] args) throws Exception {<br />
int threadcount = Integer.parseInt(args[0]);<br />
int cyclecount = Integer.parseInt(args[1]);<br />
String testtype = args[2];<br />
JbpmScalTest test = new JbpmScalTest();<br />
test.setUp();<br />
//test.testScal2();<br />
test.go(threadcount, cyclecount, testtype);<br />
}<br />
class FlowRunner implements Runnable{<br />
String name,unit=”simple”;<br />
long elapse,cycle;<br />
public FlowRunner(String n,long c,String u){<br />
name=n;cycle=c;unit=u;<br />
}<br />
public long getElapse(){return elapse;}<br />
public void run(){<br />
System.out.println(name+” started”);<br />
long start = System.currentTimeMillis();<br />
jbpmTemplate.execute(new JbpmCallback(){<br />
public Object doInJbpm(JbpmContext context) throws JbpmException {<br />
if(unit.equals(”simple”)){<br />
simpleUnit(context);<br />
}else{<br />
fullUnit(context);<br />
}<br />
return null;<br />
}<br />
});<br />
elapse = System.currentTimeMillis() - start;<br />
System.out.println(name+”,”+elapse/1000+”,”+cycle+”,”+unit);<br />
}<br />
public void simpleUnit(JbpmContext context){<br />
ProcessDefinition pd = (ProcessDefinition)context.getGraphSession().findLatestProcessDefinition(”trademgmt”);<br />
for(int i=0;i&lt;cycle;i++){<br />
ProcessInstance pi = new ProcessInstance(pd);<br />
pi.getTaskMgmtInstance().createStartTaskInstance();<br />
}<br />
}<br />
public void fullUnit(JbpmContext context){<br />
ProcessDefinition pd = (ProcessDefinition)context.getGraphSession().findLatestProcessDefinition(”trademgmt”);<br />
for(int i=0;i&lt;cycle;i++){<br />
ProcessInstance pi = new ProcessInstance(pd);<br />
TaskInstance ti = pi.getTaskMgmtInstance().createStartTaskInstance();</p>
<p>ti.getToken().signal(”saveInput”);<br />
ti.getToken().signal(”acceptInput”);<br />
ti.getToken().signal(”releaseTrade”);<br />
ti.getToken().signal(”generateObligation”);<br />
ti.getToken().signal(”generateAccountEntry”);<br />
}<br />
}</p>
<p>}<br />
@Test<br />
//2 threads<br />
public void testScal1() throws IOException {<br />
go(20,100,”full”);<br />
go(20,100,”simple”);<br />
System.in.read();<br />
}</p>
<p>private void go(int threadcount,int cyclecount,String testtype)throws IOException {<br />
FlowRunner fr;<br />
Thread t;<br />
for(int i = 0;i&lt;threadcount;i++){<br />
fr = new FlowRunner(”runner”+i,cyclecount,testtype);<br />
t = new Thread(fr);<br />
t.start();<br />
}<br />
}</p>
<p>@Test<br />
//20 threads<br />
public void testScal2() throws IOException {<br />
go(20,1000,”full”);<br />
go(20,1000,”simple”);<br />
System.in.read();<br />
}<br />
}</p>

	Tags: <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/93/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jBPM中的assignment</title>
		<link>http://zhangv.com/archives/52</link>
		<comments>http://zhangv.com/archives/52#comments</comments>
		<pubDate>Tue, 27 Nov 2007 03:48:25 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jBPM]]></category>
		<category><![CDATA[工作流]]></category>

		<guid isPermaLink="false">http://218.22.170.60/zhangv/wordpress/?p=56</guid>
		<description><![CDATA[ZhangV
在jbpm的流程定义文件（processdefinition.xml）中当定义一个task的assignment的时候有几种选择：

Swimlane


Pooled Actors


Expression


Actor


Handler

这里分别描述一下每种的用法，以及使用场景。使用场景的理解很重要，只有清楚每一种用法的所适合的情形，以及他们之间的相互转换才能说是真的“会用了”。
Swimlane
泳道是用来处理一个流程中的多个任务必须由同一个人来处理的机制。所以，当一个流程的第一个任务实例被创建到指定的泳道后，第一个任务实例中的执行人被保 存，该泳道中的后续任务的处理人都是第一个任务的处理人。所以一个泳道有一个人员被分配，并且泳道中的任务不需要再分配人员。这里是指这个流程中的参与者或者角色。在实际的业务系统中，他可能根本就不是一个业务角色，可能是一个外部应用，也可能是一个处理过程，或者是几个业务角色的结合。所以要清楚他是指“在该流程中”的角色。在jPDL的user guide中写的很清楚也反复强调 - “process role”。
通过在流程定义文件中定义：
&#60;swimlane name="leader"&#62;
&#60;assignment class="com.modofo.engine.swimlane.LeaderSwimlane"&#62;&#60;/assignment&#62;
&#60;/swimlane&#62;
同样可以实现运行时的结合实际应用进行灵活的任务分配。这也是目前我看到的使用比较多的方式。
Actor
相当于设置TaskInstance的actorId属性，主要用于获取某个actor的所有任务列表。设置方法在定义中描述actor-id属性，或者调用TaskInstance.setActorId（String）方法，或者在AssignmentHandler中调用assignable.setActorId（String）方法。
Pooled Actors
用于定义所有的任务参与人（candidates for task instance）。在查找某个参与者可参与的任务时使用，其实就是一个actor的集合，jBPM通过TaskMgmtSession.findPooledTaskInstances(String actorId)或者TaskMgmtSession.findPooledTaskInstances(List actorIds) 来查找任务集合。
注意：actor的优先级比pooled actors要高，所以如果同时设置两者，那jBPM只会用actor来查找，而忽略pooled actors。
一句话： actor被用来获取某个参与者的个人任务列表，pooled actors用来获取某个参与者可以参与的所有任务列表，或者说组任务列表。
使用这个actor集合的初衷就是为了不让任务分配和角色体系耦合。流程定义中始终都是只有参与者的名称和集合，而不存在用户，角色和用户组的具体设计。而使用Expression就耦合了这些信息在流程定义里。
Expression
如果你使用jBPM的identity component的话。你可以使用表达式定义的任务分配模式。通常这个表达式的形式是：
&#60;assignment expression='previous --&#62; group(hierarchy) --&#62; member(boss)' /&#62;
我看了之后也不是很清楚，group和member是jBPM的identity componenet的概念，这个表达的意思大概是：使用之前的actor，然后在hierarchy组，并且member（角色）是boss的所有actor。这种方法仅限于使用jBPM的IC时使用。
Handler
指定你自己的AssignmentHandler实现。该接口只有assign方法。这种任务分配方式主要用于运行时的任务分配，而不是hardcode到定义文件里。使用场景，如果不想让原本应用中的访问控制与jBPM耦合起来，就可以使用这种方法来将jBPM中的任务分配代理出来。当然更好的定义是用swimlane,这样可以让定义文件看起来不是很凌乱。

	Tags: Java, jBPM, 工作流
]]></description>
			<content:encoded><![CDATA[<p>ZhangV</p>
<p>在jbpm的流程定义文件（processdefinition.xml）中当定义一个task的assignment的时候有几种选择：</p>
<ul>
<li>Swimlane</li>
</ul>
<ul>
<li>Pooled Actors</li>
</ul>
<ul>
<li>Expression</li>
</ul>
<ul>
<li>Actor</li>
</ul>
<ul>
<li>Handler</li>
</ul>
<p>这里分别描述一下每种的用法，以及使用场景。使用场景的理解很重要，只有清楚每一种用法的所适合的情形，以及他们之间的相互转换才能说是真的“会用了”。</p>
<p>Swimlane<br />
泳道是用来处理一个流程中的多个任务必须由同一个人来处理的机制。所以，当一个流程的第一个任务实例被创建到指定的泳道后，第一个任务实例中的执行人被保 存，该泳道中的后续任务的处理人都是第一个任务的处理人。所以一个泳道有一个人员被分配，并且泳道中的任务不需要再分配人员。这里是指这个流程中的参与者或者角色。在实际的业务系统中，他可能根本就不是一个业务角色，可能是一个外部应用，也可能是一个处理过程，或者是几个业务角色的结合。所以要清楚他是指“在该流程中”的角色。在jPDL的user guide中写的很清楚也反复强调 - “process role”。<br />
通过在流程定义文件中定义：<br />
&lt;swimlane name="leader"&gt;<br />
&lt;assignment class="com.modofo.engine.swimlane.LeaderSwimlane"&gt;&lt;/assignment&gt;<br />
&lt;/swimlane&gt;<br />
同样可以实现运行时的结合实际应用进行灵活的任务分配。这也是目前我看到的使用比较多的方式。</p>
<p>Actor<br />
相当于设置TaskInstance的actorId属性，主要用于获取某个actor的所有任务列表。设置方法在定义中描述actor-id属性，或者调用TaskInstance.setActorId（String）方法，或者在AssignmentHandler中调用assignable.setActorId（String）方法。</p>
<p>Pooled Actors<br />
用于定义所有的任务参与人（candidates for task instance）。在查找某个参与者可参与的任务时使用，其实就是一个actor的集合，jBPM通过TaskMgmtSession.findPooledTaskInstances(String actorId)或者TaskMgmtSession.findPooledTaskInstances(List actorIds) 来查找任务集合。<br />
注意：actor的优先级比pooled actors要高，所以如果同时设置两者，那jBPM只会用actor来查找，而忽略pooled actors。</p>
<p>一句话： actor被用来获取某个参与者的个人任务列表，pooled actors用来获取某个参与者可以参与的所有任务列表，或者说组任务列表。<br />
使用这个actor集合的初衷就是为了不让任务分配和角色体系耦合。流程定义中始终都是只有参与者的名称和集合，而不存在用户，角色和用户组的具体设计。而使用Expression就耦合了这些信息在流程定义里。</p>
<p>Expression<br />
如果你使用jBPM的identity component的话。你可以使用表达式定义的任务分配模式。通常这个表达式的形式是：</p>
<p>&lt;assignment expression='previous --&gt; group(hierarchy) --&gt; member(boss)' /&gt;<br />
我看了之后也不是很清楚，group和member是jBPM的identity componenet的概念，这个表达的意思大概是：使用之前的actor，然后在hierarchy组，并且member（角色）是boss的所有actor。这种方法仅限于使用jBPM的IC时使用。</p>
<p>Handler</p>
<p>指定你自己的AssignmentHandler实现。该接口只有assign方法。这种任务分配方式主要用于运行时的任务分配，而不是hardcode到定义文件里。使用场景，如果不想让原本应用中的访问控制与jBPM耦合起来，就可以使用这种方法来将jBPM中的任务分配代理出来。当然更好的定义是用swimlane,这样可以让定义文件看起来不是很凌乱。</p>

	Tags: <a href="http://zhangv.com/archives/tag/java" title="Java" rel="tag">Java</a>, <a href="http://zhangv.com/archives/tag/jbpm" title="jBPM" rel="tag">jBPM</a>, <a href="http://zhangv.com/archives/tag/%e5%b7%a5%e4%bd%9c%e6%b5%81" title="工作流" rel="tag">工作流</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/52/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

