Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Stardust/Knowledge Base/API/ExamplesofAPIUsage/StartProcess"

Line 8: Line 8:
 
==== Requirements<br>  ====
 
==== Requirements<br>  ====
  
You need an &lt;a href="STP/Stardust/KnowledgeBase/API/ExamplesofAPIUsage/Initialization"&gt;initialized workflow&lt;/a&gt; service and the id of the process definition you want to start. &lt;a href="STP/Stardust/KnowledgeBase/API/ExamplesofAPIUsage/CompleteAPIExample"&gt;Reference Model.&lt;/a&gt;<br>  
+
You need an [[STP/Stardust/KnowledgeBase/API/ExamplesofAPIUsage/Initialization|initialized workflow]] service and the id of the process definition you want to start. [[STP/Stardust/KnowledgeBase/API/ExamplesofAPIUsage/CompleteAPIExample|Reference Model.]]<br>  
  
&lt;img src="/images/thumb/d/d6/Stardust_EmbeddedAPIStartProcess.png/421px-Stardust_EmbeddedAPIStartProcess.png" _fck_mw_filename="Stardust EmbeddedAPIStartProcess.png" _fck_mw_width="425" _fck_mw_height="250" alt="Stardust Embedded API Start Process" /&gt;
+
[[Image:Stardust_EmbeddedAPIStartProcess.png|420x250px|Stardust Embedded API Start Process]]<br>
  
 
==== Implementation<br>  ====
 
==== Implementation<br>  ====

Revision as of 06:20, 17 November 2011

Start a Process

Purpose

Creating and starting a process instance is quite easy via the API. Each process instance will process its activity instances until it has to wait on an external event like a JMS response, a mail or a user interaction.

Requirements

You need an initialized workflow service and the id of the process definition you want to start. Reference Model.

Stardust Embedded API Start Process

Implementation

Exception handling

To keep the example code clear the exception handling is very simple. If you use this code productive, please add appropriate exception handling!

Missing parts

The missing code fragments ([...]) can be found <a href="STP/Stardust/KnowledgeBase/API/ExamplesofAPIUsage/CompleteAPIExample">here</a>. They are omnited to present only the new parts. fckLRpackage com.sungard.wiki;fckLRfckLRimport ag.carnot.workflow.runtime.ProcessInstance;fckLRimport [...];fckLRfckLRpublic class WikiProgram {fckLR [...]fckLRfckLR public static void main(String[] unused) {fckLR try {fckLR init();fckLR ProcessInstance lProcessInstance = startProcess();fckLR // Do stuff with the process instance herefckLR } finally {fckLR uninit();fckLR }fckLR }fckLRfckLR static ProcessInstance startProcess() {fckLR ProcessInstance lProcessInstance = workflowService.startProcess("DoWhileLoop", Collections.EMPTY_MAP, true);fckLR return lProcessInstance;fckLR }fckLR static void init() {[...]}fckLR static void uninit() {[...]}fckLR}fckLR

As you can see, the API call to start the process is quite simple

  • Just provide the ID of the process definition.
  • As long as you don't need any in data you can provide an empty map. Otherwise you can inject your data via this collection.
  • The started process instance will proceed until it reaches an interactive activity (or until it has to wait for an external event).



Back to the top