Writing a Custom Business Agent/Service

In this section:

The engine uses agent programs to perform the final business-level operations on all incoming documents. Business agents form the basis of the iWay adapter offering, and most adapters are composed of combinations of business agents. As delivered, the server is equipped with many supplied business agents and adapters to perform standard tasks. A simple description of a few of the more useful ones are found in Standard Business Exits.

Business agents can be configured directly or combined and configured through the process flow tool iWay Designer. Agents appear as services in the iWay Designer tool.

The business agent adapter embodies the application logic needed to process the document payload. Users can program business agents appropriate to their document and task. These business agents are then invoked on an as-needed basis.


Top of page

x
Selecting the Business Agent

The server selects the business processing logic to be applied to the incoming document based on the server's configuration. Business processing logic can be one business agent, a business agent stack, or a process flow to be used for the incoming document. The selection happens immediately before execution. The server selects the processing logic using the router as described in Routing.

The router:

  1. First, looks for a process flow.
  2. If the router does not find a process flow, it looks for an agent stack.
  3. If the router does not find an agent stack, the flow fails.

Business agents are Java class files that are located at run time. Therefore, they must be carried in the classpath.

Business agents can be stacked, such that the output of one business agent becomes the input to the next business agent. A typical use of this is the case in which the first business agent returns a document acknowledgment such as an EDI 997, while the second business agent performs the actual business function of the incoming document.

The previous diagram shows a stack of business agents working on a document, the first of which is an ack business agent pushed onto the business agent stack by the rules system. The incoming document goes first to the ack business agent, which produces an output document to be emitted. The original input is then passed to business agent one. Business agent one prepares an output document, but because the configuration marks that the business agent is stacked, the document flows not to the emitting system, but instead to the next business agent, two. Business agent two is not stacked, so on completion the document that it prepares is emitted through the output system.

Process flows work in much the same manner, with the output document from one being passed on as the input document for the next. In the iWay Designer, business agents appear as services, but the linkage approach is the same.


iWay Software