Partial Flow Agent Composition

In some use cases or scenarios, you may require two or more process flow services (agents or nodes) to appear as a single node. Once defined, this can simplify process flow development when the composed unit is frequently used. Improved process flow performance is also a benefit. An example for such a composed component might be a single component that:

Composition incorporates existing services, generating configuration groups in iWay Integration Tools (iIT) for each incorporated service after discarding duplicates. You must compile the composed service in Java just as you would your own agent. The included services will not be brought into your new service, but will reside in the existing iwcore or other .jar file on the classpath.

As each included service executes, it passes the current document to the next incorporated service (or out of the composed service) in the Success edge. If an incorporated service returns an edge code other than Success, then the service terminates on that edge. Since the included services operate on a stack of included agents, this is referred to as a Stack Agent. The example that is described in this section will stack two agents (simplifying a common task of formatting a document for mailing and then sending it). The use of the tree map causes the agents to execute in the defined order. The properties of the tree map are described in the following table:

Key

Value

Class name of the agent

Prefix for the agent's configuration groups to differentiate the combined configuration parameters.

The remaining required methods give your composite agent a label, description, and category.

There is no requirement for the composed Stack Agent to only include iWay agents. The agent must be able to execute independently, even if its purpose is only to be part of a Stack Agent.

public final class FormatAndMail extends XDStackAgentBase
{
  private static Map<String, String> stackMap = new TreeMap<>(); // 
  class,GroupnamePrefix
  static
  {
      stackMap.put("com.ibi.agents.XDTransformAgent", "TransformIn");
      stackMap.put("com.ibi.agents.XDEmailEmitAgent",   "Mail");
  }
  public StackTestAgent2()
  {
      ExitInfo ei = makeExitInfo(stackMap);
      setExitInfo(ei);
  }
// Because we inherit from XDStackAgentBase, we must override visibility 
in order to show up
  public int getVisibility()
  {
      return VISIBILITY_VISIBLE;
  }
  public String getCategories()   // which categories should the new stacked 
  agent appear in?
  {
      return GROUP_MAIL;
  }
  public String getDesc()
  {
      return "Email Error Message According to Company Standards.";
  }
  public String getLabel()
  {
      return "Send Error";
  }
}