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 7: Line 7:
 
==== Requirements<br>  ====
 
==== Requirements<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>  
+
You need an [[Stardust/Knowledge_Base/API/ExamplesofAPIUsage/Initialization|Initialized workflow]] service and the id of the process definition you want to start. [[Stardust/Knowledge_Base/API/ExamplesofAPIUsage/CompleteAPIExample|Reference Model.]]<br>  
  
[[Image:Stardust_EmbeddedAPIStartProcess.png|420x250px|Stardust Embedded API Start Process]]<br>
+
[[Image:Stardust EmbeddedAPIStartProcess.png|420x250px|Stardust Embedded API Start Process]]<br>
  
 
==== Implementation<br>  ====
 
==== Implementation<br>  ====

Latest revision as of 11:19, 25 June 2013

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 here.

package com.sungard.wiki;
 
import ag.carnot.workflow.runtime.ProcessInstance;
import [...];
 
public class WikiProgram {
	[...]
	public static void main(String[] unused) {
		try {
    		    init();
		    ProcessInstance lProcessInstance = startProcess();
			// Do stuff with the process instance here
		} finally {
			uninit();
		}
	}
 
	static ProcessInstance startProcess() {
		ProcessInstance lProcessInstance = workflowService.startProcess("DoWhileLoop", Collections.EMPTY_MAP, true);
		return lProcessInstance;
	}
	static void init() {[...]}
	static void uninit() {[...]}
}

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