Show Table of Contents
9.16. Batch-execution and Command Examples
- There is currently no XML schema to support schema validation. This is the basic format. The root element is <batch-execution> and it can contain zero or more commands elements:
<batch-execution> ... </batch-execution>
- The insert element features an "out-identifier" attribute so the inserted object will be returned as part of the result payload:
<batch-execution> <insert out-identifier='userVar'> ... </insert> </batch-execution> - It's also possible to insert a collection of objects using the <insert-elements> element. This command does not support an out-identifier. The
org.domain.UserClassis just an illustrative user object that XStream would serialize:<batch-execution> <insert-elements> <org.domain.UserClass> ... </org.domain.UserClass> <org.domain.UserClass> ... </org.domain.UserClass> <org.domain.UserClass> ... </org.domain.UserClass> </insert-elements> </batch-execution> - The
<set-global>element sets a global for the session:<batch-execution> <set-global identifier='userVar'> <org.domain.UserClass> ... </org.domain.UserClass> </set-global> </batch-execution> <set-global>also supports two other optional attributes:outandout-identifier. A true value for the booleanoutwill add the global to the<batch-execution-results>payload, using the name from theidentifierattribute.out-identifierworks likeoutbut additionally allows you to override the identifier used in the<batch-execution-results>payload:<batch-execution> <set-global identifier='userVar1' out='true'> <org.domain.UserClass> ... </org.domain.UserClass> </set-global> <set-global identifier='userVar2' out-identifier='alternativeUserVar2'> <org.domain.UserClass> ... </org.domain.UserClass> </set-global> </batch-execution>- There is a
<get-global>element without contents. It only has anout-identifierattribute. There is no need for anoutattribute because retrieving the value is the sole purpose of a<get-global>element:<batch-execution> <get-global identifier='userVar1' /> <get-global identifier='userVar2' out-identifier='alternativeUserVar2'/> </batch-execution>
- The query command supports both parameter and parameterless queries. The
nameattribute is the name of the query to be called, and theout-identifieris the identifier to be used for the query results in the<execution-results>payload:<batch-execution> <query out-identifier='cars' name='cars'/> <query out-identifier='cars2' name='carsWithParams'> <string>red</string> <string>blue</string> </query> </batch-execution> - The
<start-process>command accepts optional parameters:<batch-execution> <startProcess processId='org.drools.actions'> <parameter identifier='person'> <org.drools.TestVariable> <name>John Doe</name> </org.drools.TestVariable> </parameter> </startProcess> </batch-execution - The signal event command allows you to identify processes:
<signal-event process-instance-id='1' event-type='MyEvent'> <string>MyValue</string> </signal-event>
- The complete work item command notifies users when a process is completed:
<complete-work-item id='" + workItem.getId() + "' > <result identifier='Result'> <string>SomeOtherString</string> </result> </complete-work-item> - The abort work item command lets you cancel a process while it is running:
<abort-work-item id='21' />

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.