03-27-2013 08:54 AM
05-23-2013 08:54 AM
SimulationEngine simulationEngine= SimulationEngineConfigurationImpl.createStandaloneSimulationEngineConfiguration().buildSimulationEngine();
SimulationInstance simulationInstance = simulationEngine.getRuntimeService().startSimulationInstanceByKey("Monitor escalation", …..);
05-23-2013 11:08 AM
05-24-2013 02:36 AM
/**
* Starts a new simulation instance
*
* @param name
* @param description
* @param author
* @param start
* @param end
* @param replication
* @param seed - pseudo random number generator seed.
* @param simulationConfigUrl - repository service is not copied form activiti engine - claspath resources are used.
* @return
*/
SimulationInstance startSimulationInstanceByKey(String name, String description, String author, Date start, Date end, int replication, Long seed, String simulationConfigUrl);
<serviceTask id="rejection_email" name="Send rejection e-mail" activiti:type="mail" sim:behavior="org.activiti.crystalball.simulator.delegate.Noop">
<extensionElements>
<activiti:field name="to" expression="to@domain"></activiti:field>
<activiti:field name="from" expression="from@domain"></activiti:field>
<activiti:field name="text">
<activiti:expression><![CDATA[text]]></activiti:expression>
</activiti:field>
</extensionElements>
</serviceTask>
sim:behavior="org.activiti.crystalball.simulator.delegate.Noop" (behavior can be set for user task too).
<bean id="simulationRunHelper" class="org.activiti.crystalball.simulator.impl.CopySimulationRunHelper">
<constructor-arg index ="0" value="${tempDir:target}/basicSimulation.h2.db"/>
<constructor-arg index ="1" value="${tempDir:target}/${simulationRunId:default}.h2.db"/>
</bean>
SimulationRun starts activiti process engine to simulate process instances execution. Process engine configuration:
<bean id="simProcessEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="simDataSource" />
<property name="transactionManager" ref="simTransactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
<property name="jobExecutor" ref="simDefaultJobExecutor"/>
<property name="preParseListeners">
<list>
<bean class="org.activiti.crystalball.simulator.parse.SimulationBpmnParseListener"/>
</list>
</property>
<property name="processEngineName" value="${simulationRunId:default}"/>
<property name="deploymentResources">
<list>
<value>org/activiti/crystalball/examples/mortages/MortageDemo-1-monitoring.bpmn</value>
</list>
</property>
</bean>
<bean id="simDefaultJobExecutor" class="org.activiti.crystalball.simulator.processengine.jobexecutor.SimulationDefaultJobExecutor">
<property name="waitTimeInMillis" value="300000"/>
</bean>
Simulation process engine has to use simDefaultJobExecutor which runs process jobs in the virtual simulation time - ability to simulate timers.
<!– User tasks executors –>
<bean id="userTaskExecutor" class="org.activiti.crystalball.simulator.executor.impl.RandomUserMapTaskExecutor">
<constructor-arg index="0" value="300000"/> <!– from 5mins to 1100 sec –>
<constructor-arg index="1" value="1100000"/>
<property name="taskVariablesMap">
<map>
<!– TASK preliminary_judgement possibilities –>
<entry key="preliminary_judgement">
<list>
<map>
<entry key="approved"><value type="java.lang.Boolean">True</value></entry>
</map>
<map>
<entry key="approved"><value type="java.lang.Boolean">True</value></entry>
</map>
</list>
</entry>
<entry key="final_evaluation">
<list>
<map>
<entry key="ok"><value type="java.lang.Boolean">True</value></entry>
</map>
<map>
<entry key="ok"><value type="java.lang.Boolean">False</value></entry>
</map>
</list>
</entry>
</map>
</property>
</bean>
ProbabilityGraphGenerator generator = new ProbabilityGraphGenerator();
generator.generateGraph(simulationEngine.getRuntimeService(), simulationInstance, "mortagedemo-0:1:4", "mortagedemo-0", "activity_exists", System.getProperty("tempDir", "target") + "/monitoringTest.jpg");
05-24-2013 05:40 AM
05-24-2013 07:09 AM
do you mandate the Noop ServiceTask?
It would be more useful if you allow to upload any process xml. BUT before you hand them to the simulation engine you swap all the classes with the Noop's (and similar for listeners on execution/task of course)Yes, it would be one possibility and can be used in the real application. On the other hand we can loose possibility to simulate some nodes in the process as real nodes (e.g. we can simulate load on mail server, or service calls).
05-24-2013 11:40 AM
05-29-2013 03:55 AM
06-07-2013 12:02 PM
06-10-2013 10:18 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.