Analysis Agent Assignment and Cloning

All agents handling UDRs forward UDR references on all outgoing links from the agent, that is, the same instance of the UDR is referred to from all agents in a workflow. This is accepted if all agents only  read the UDR content. If an agent alters the content, it effectively alters the content for all other agents that receive the UDR. To avoid this behavior, the UDR must be cloned. Refer to the following examples for more information.

Note!

Cloning is a costly operation in terms of performance, therefore it must be used with care.

Example - Analysis agent assignment and cloning, case 1



Assignment case 1

In this example, you want to alter the UDR in the Analysis agent and send it to Encoder_1, while still sending its original value to Encoder_2. To achieve this, the UDR must be cloned. The following code creates, alters, and routes a cloned UDR on r_2 and leaves the original UDR unchanged.

input=udrClone(input); input.MyNumber=54; udrRoute(input);

Note that input is a built-in variable in APL, and must be used for all UDRs entering the agent.



Example - Analysis agent assignment and cloning, case 2

An alternative solution to the one presented in the previous example is to clone the UDRs in an Analysis agent and then route the UDRs to another Analysis agent in which amendment is performed.



Assignment case 2

Configurations in the Analysis_1 agent:

udrRoute(input,"r_3",clone); input.MyNumber=54; udrRoute(input,"r_2");

The incoming UDR is cloned and the clone is routed on to r_3. After that the original UDR can be altered and routed to r_2.