Accum EOS Agent (com.ibi.agents.XDAccumEOSAgent)

Syntax:

com.ibi.agents.XDAccumEOSAgent

iIT Service Object:

accumulation: Accum EOS Agent

Description:

This service accumulates document pieces and emits a full document at End of Stream (EOS).

Parameters:

Parameter

Description

Final Root *

The name and description of this parameter is derived from viewing XML documents as trees of element objects. A well-formed XML document has exactly one root element (also called document element). When you configure the Accumulate service, the name of the root element for the resulting document must be provided as the parameter. This means that the result of the processing must be enclosed between a root start-tag and a corresponding end-tag with the specified name. The root element of this document tree is serving as a wrapper for the accumulated document parts, combining them into a well-formed XML document. For example:

<Final Root Parameter Value>
   <Accumulated Piece> … </Accumulated Piece>
   <Accumulated Piece> ... </Accumulated Piece>
    …
</Final Root Parameter Value >

Edges:

The following table lists the available line edges for the Accumulate EOS Service (com.ibi.agents.XDAccumEOSAgent).

Line Edge

Description

OnError

Error

OnSuccess

Success

OnFailure

Failure

OnCustom

  • OnError
  • OnSuccess
  • OnFailure
  • fail_parse

Example:

The best application of the Accumulate EOS Service would be to merge the documents produced by the splitter for the final output. The architecture of a sample channel would contain an inlet with a File listener and a splitter (for example, XML Splitter preparser). The route would contain a process flow with the Accumulate EOS Service object.

In this example, the following iWay response document is used as the incoming document:

<?xml version="1.0" encoding="UTF-8"?>
<iway>
<response totalrows="3">
<cncresult>
<result format="field">
<resultset rowcount="3">
<colinfo>
<col type="4" length="11" offset="0">Document_Link_ID</col>
<col type="12" length="50" offset="11">Value</col>
</colinfo>
 <row>
   <Document_Link_ID type="4">103</Document_Link_ID>
   <Value type="12">invoice</Value>
 </row>
 <row>
   <Document_Link_ID type="4">103</Document_Link_ID>
   <Value type="12">Milestone</Value>
 </row>
 <row>
   <Document_Link_ID type="4">103</Document_Link_ID>
   <Value type="12">Work Order</Value>
 </row>
</resultset>
</result>
</cncresult>
<timestamp>2007-01-10T17:02:48Z</timestamp>
<execstatus>0</execstatus>
</response>
</iway>

In this incoming document, notice that the <row> element loops three times. Therefore, a splitter can be used on this tag to split the incoming document into three individual documents, where each document corresponds to one loop iteration of the <row> element.

The XML Splitter preparser is configured to split the iWay response document into multiple XML documents, each containing one row, as shown in the following image:

Notice that a counter is being added to each row. This is configured in the event that there is a need to merge the rows again into a single document after performing certain operations.

The Accumulate service can be used to assemble these individual documents into one merged document. In this case, the root element iway would be specified as a value for the Final Root parameter.

The following is the assembled output of the channel:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<iway>
 <eda count="1">
  <response totalrows="3">
   <cncresult>
    <result format="field">
     <resultset rowcount="3">
      <colinfo>
       <col type="4" length="11" offset="0">Document_Link_ID</col>
       <col type="12" length="50" offset="11">Value</col>
      </colinfo>
      <row>
       <Document_Link_ID type="4">103</Document_Link_ID>
        <Value type="12">invoice</Value>
      </row>
     </resultset>
    </result>
   </cncresult>
  </response>
 </eda>
 <eda count="2">
  <response totalrows="3">
   <cncresult>
    <result format="field">
     <resultset rowcount="3">
      <colinfo>
       <col type="4" length="11" offset="0">Document_Link_ID</col>
       <col type="12" length="50" offset="11">Value</col></colinfo>
       <row>
       <Document_Link_ID type="4">103</Document_Link_ID>
       <Value type="12">Milestone</Value>
       </row>
     </resultset>
    </result>
   </cncresult>
  </response>
 </eda>
 <eda count="3">
  <response totalrows="3">
   <cncresult>
    <result format="field">
     <resultset rowcount="3">
      <colinfo>
       <col type="4" length="11" offset="0">Document_Link_ID</col>
       <col type="12" length="50" offset="11">Value</col>
      </colinfo>
      <row>
       <Document_Link_ID type="4">103</Document_Link_ID>
       <Value type="12">Work Order</Value>
      </row>
     </resultset>
    </result>
   </cncresult>
  </response>
 </eda>
</iway>

Note the differences between the incoming and outgoing document. In the outgoing document, the structure is slightly rearranged and a loop counter is represented by the <eda> element with an incrementing count attribute. This counter is used to mark each iteration of the loop.