When necessary, an actor-chain can invoke a child actor-chain. The actor element passes information from that parent actor to a child actor, and executes the child actor-chain. Note that you must explicitly define the values that will be pass from the parent to the child actor-chain.
Actor elements contain the following:
Attribute/Element | Description |
---|---|
| Provides the variable name of the child chain returned by the |
| The chain ID of the actor component to be executed. If the |
| The actor ID. This attribute is used for actor ordering. |
| The Nucleus path of the actor component to invoke. |
| This element defines actors that must be executed prior to the execution of the current actor. There can be multiple |
| This element defines actors that, if present, must be executed prior to the execution of the current actor. There can be multiple |
| This element defines each actor’s input. Actors can have multiple input elements. |
| This element defines each actor’s output. |
The ActorContext
and ModelMap
of the parent actor are not passed to the child actor. The following example shows how information can be passed from a child actor-chain to a parent actor-chain. Note that request parameters do not need to be passed in explicitly as inputs; you can pass in their variables:
<! – Call another actor-chain to get quantity -> <actor id="addItem" name="/atg/commerce/gifts/NewListActor" return-model-var="addItemVar"> <input name="quantity" value="${quantity}"/> <output name="quantity" value="${addItemVar}"/ > </actor>
In the above example, the parent actor-chain contains a quantity ModelMap
. Map entries are based upon the child actor-chain. For information on working with implicit objects, which can be used in any chain, refer to the Working with Implicit Objects section.
To pass the entire child ModelMap
back to the parent and not have it nested under another variable name, use the add-map-children="true"
in the output
element to copy the child ModelMap's
keys to the parent ModelMap
.
<! – Call another actor-chain to get quantity -> <actor id="addItem" name="/atg/commerce/gifts/NewListActor" return-model-var="addItemVar"> <input name="quantity" value="${quantity}"/> <output id="quantity" add-map-children="true" value="${addItemVar}"/ > </actor>