Title: Creating a Process Category: documentation ## Overview [TOC] ## Deploying a Process in ODE Each deployment is a directory with all relevant deployment artifacts. At the minimum it will contain the deployment descriptor, one or more process definitions (BPEL or .cbp), WSDL and XSDs (excluding those compiled into the .cbp). It may also contain other files, such as SVGs or XSLs. The deployment descriptor is a file named deploy.xml (see the next paragraoh for its description). During deployment, the process engine loads all documents from the deployment descriptor. Loading documents allow it to reference processes, service and schema definitions using fully qualified names, and import based on namespaces instead of locations. To deploy in ODE, just copy the whole directory containing your artifacts (the directory itself, not only its content) in the path `%DEPLOYMENT_ROOT%/WEB-INF/processes` (in Tomcat it would be `%TOMCAT_HOME%/webapps/ode/WEB-INF/processes`). ## Deployment Descriptor To deploy your process in ODE you will need to create a simple deployment descriptor with basic information. The deploy.xml file configures one or several processes to use specific services. For each process, deploy.xml must supply binding information for partner links to concrete WSDL services. Every partner link used with a activity must be matched with a element, and every partnerLink used in an activity must be matched with an element in *deploy.xml* (unless that partnerLink has initializePartnerRole="false"). ## Formal definition The XML schema describing ODE's deployment descriptor is available [here](http://svn.apache.org/viewvc/ode/trunk/bpel-schemas/src/main/xsd/dd.xsd?view=markup). The root element, deploy, contains a list of all deployed processes from the deployment directory: * { other elements } Each process is identified by its qualified name and specifies bindings for provided and invoked services: ( | )* { other elements } Each process element must provide a `name` attribute with the qualified name of the process. Optionally, a `fileName` attribute can be used to specify the location of the BPEL process definition (the .bpel file). The `fileName` attribute does not need to be provided unless non-standard compilation options are used or the `bpel11wsdlFileName` attribute is used to specify a WSDL document for a BPEL 1.1 process. Each `` element must enumerate the services provided by the process and bind each service to an endpoint. This is done through `` elements which associates `partnerLink`s with `endpoint`s: Note, that only one partnerLink can be bound to any specified endpoint. The port attribute can be used to select a particular endpoint from the service definition. ## Examples A very simple process that would only be invoked would use a deploy.xml very similar to: true See the complete example [here](https://github.com/apache/ode/tree/master/distro/src/examples-war/HelloWorld2). A deployment including two processes invoking each other and whose execution would be triggered by a first message would look like: resp:MagicSessionResponder See the complete example [here](https://github.com/apache/ode/tree/master/distro/src/examples-war/MagicSession). ## Additional settings ### In memory execution For performance purposes, you can define a process as being executed only in-memory. This greatly reduces the amount of generated queries and puts far less load on your database. Both persistent and non-persistent processes can cohabit in ODE. To declare a process as in-memory just add an in-memory element in your deploy.xml: true Be aware that in-memory executions introduces many restrictions on your process and what it can do. The instances of these processes can't be queried by using the [Management API](management-api.html). The process definition can only include one single receive activity (the one that will trigger the instance creation). ### User-defined process properties User-defined process properties provide means to configure process models and their instances. They are either statically declared and set in the deployment descriptor `deploy.xml` or can be set using the process management API. All instances of a process model share the same set of process properties. If a process property changes, it changes for all instances. A process property is identified by a QName and can carry a string as value. To set a process property statically in the deployment descriptor, add the following snippet to your `deploy.xml`: ... 4711 ... It is also possible to set or change a property by calling the PM API function `setProcessProperty(final QName pid, final QName propertyName, final String value)`. Once set, process properties can be used in two different ways: * Using XPath in process models * Using Java in ODE extensions For instance, instead of hard coding the amount of money that triggers an in-depth check in a loan approval process, you could read a process property instead. That way you can reconfigure your process without having to redeploy the process again. To read process properties in a BPEL process, you can use the non-standard XPath extension `bpws:process-property(propertyName)`, e.g. in a transition condition or in an assign activity: ... bpws:process-property(loan:loanThreshold) $threshold ...