Service "groups" are a technique for grouping together Services where there is a need to run all the Services together.
Create or find an existing Service group definition XML document. This XML document will have an XML version declaration as follows:
<?xml version="1.0" encoding="UTF-8" ?>
And a Service group XML schema declaration as shown:
<service-group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://ofbiz.apache.org/dtds/service-group.xsd">
If creating a new Service group definition XML document, ensure that this document is configured in the containing Component's ofbiz-component.xml
file. For example, if creating a Service group definition XML document in the servicedef
directory, add a line similar to the following to the ofbiz-component.xml
file:
<service-resource type="group" loader="main" location="servicedef/groups.xml"/>
To group Services together, follow these steps:
group
elements as shown here. Each group
element defines a Service group:<group name="updateCreditCardAndAddress" send-mode="all"> </group>
group
element, add one or more invoke
declaration(s). Each invoke
declaration points to a Service:<invoke name="createPostalAddress" mode="sync" result-to-context="true"/> <invoke name="createCreditCard" mode="sync"/> <invoke name="createPartyContactMech" mode="sync"/>
Service groups are a set of Services that should all run as a result of the initial Service call. Unlike SECAs, where conditions and triggers determine which Services will be run during any particular invocation, Service groups are used to indicate that all Services within the group should be run. Note, it is possible to have Service groups with participating Services that have SECAs defined.
The following table provides some of the more often used Service group configuration elements. Attribute values include:
group tag | ||
---|---|---|
Attribute name |
Required? |
Description |
|
Yes |
The name of the Service this action will invoke. |
|
No |
The mode in which the Service(s) should be invoked. Valid values: "none", "all", "first-available", "random", "round-robin". The default is "all". |
To configure one or more Services within a group
element declaration, add invoke
elements configured as follows:
invoke tag | ||
---|---|---|
Attribute name |
Required? |
Description |
|
No |
The name of the Service this |
|
Yes |
The mode in which this Service should be invoked. Can be |
|
No |
Should the results of the action Service update the main Service's context. Valid values: "true", "false". Default is "false". |
13.59.141.75