2.1 init

The init function block is executed once for each invocation of the workflow and enables you to assign, for example, an argument with an initial value.

Note!

Avoid reading MIM parameters from within init. The order by which agents are initialized is undefined and MIM parameters are therefore not necessarily set during the initialize phase.

The route function cannot be used in the init block.

The init function block will parse in an Agent Environment object as well as Map<String,String> known as userdata. For more on the Agent Environment object, please refer to 3. Java General Functions

Example - init

This example shows the init function block receiving the userdata and displaying values in within the map.

public void init(AgentEnv env, Map<String,String> userdata) throws Exception {
    Map<String, String> myValue = userdata;

    env.debug("myValue size: " + myValue.size());
    env.debug("current: " + myValue.get("current"));
}