IBM Support

Implementing bulk replay in IBM Sterling File Gateway (SFG)

Technical Blog Post


Abstract

Implementing bulk replay in IBM Sterling File Gateway (SFG)

Body

Currently, in SFG version 2.2.4.2 (Sterling B2B Integrator 5.2.4.2) and lower, there is no way of doing bulk replay of failed routes, you need to replay them one by one via the SFG UI.

This can be cumbersome and cause a lot of overhead if you run into issues and have hundreds of routes to replay.



This bulk replay functionality will be implemented in SI out of the box in SFG 2.2.5 (SI 5.2.5), but if you cannot update at this time, this blog aims to help you implement a business process that will replay all failed routes in a bulk instead of having to replay them one by one.

You can run the BP manually when needed or you can schedule it to run at certain days and times.

If you don't want some of the failed routes to be replayed, you simply need to mark then as reviewed using the SFG UI.



Business Process Description:

  1. The BP will use the Lightweight JDBC adapter to query the database table FG_ARRIVEDFILE for any routes that have a failed state and have not yet been reviewed. See below, an example of the select SQL query to use with the adapter, note that you might have to adjust it depending on the database used

SELECT a.ARRIVEDFILE_KEY as ARRIVEDFILE_KEY FROM FG_ARRIVEDFILE a WHERE a.STATE='Failed' and a.REVIEWED=0

Moreover, see the example below displaying the configuration of the LJDBC adapter used in this scenario. You would need to adjust it depending on the pool used:

image

2. Use DocToDOM on the input side of the LJDBC adapter BPML configuration to parse the contents of the LJDBC results into ProcessData

<assign to="Replay" from="DocToDOM(PrimaryDocument, 'false')//row"></assign>



The results on ProcessData should look like the example presented below:



<ProcessData>

<Replay>

<row>

<ARRIVEDFILE_KEY>20141024121237513245852 </ARRIVEDFILE_KEY>

</row>

<row>

<ARRIVEDFILE_KEY>20141024121737513245853 </ARRIVEDFILE_KEY>

</row>

<row>

<ARRIVEDFILE_KEY>20141024121843323245878 </ARRIVEDFILE_KEY>

</row>

</Replay>

</ProcessData>





3. Create a loop that loops through all returned rows and run the XAPI service for each of them.



4. The XAPI service will use the replayFgArrivedFile api and will use as input an xml created using the arrived file keys values returned by the LJDBC adapter



The xml to be used as input should contain at least the arrived file key information and the comment to flag the route being replayed with a useful comment:



<replayFgArrivedFile ArrivedFileKey="20141024129054453245904 " Comment="Bulk Replay"/>





5. When the BP runs, it will replay the failed route and create a new route for the replay, it will also mark the failed route as reviewed.



6. The BP will also add an event to the "Failed" route stating that it was replayed and showing the comment used in the XAPI service xml element.



image





For your convenience, please find below a sample BPML that performs the complete process described above.

Please be sure to test it thoroughly in your test or development system before implementing it into production.

If you have any issues implementing this functionality, do not hesitate to open a PMR with IBM SI support.



<process name="test_replayFGArrivedFile">

<rule name="MoreKeys">

<condition>number(loopcounter)&lt;=number(keycount)</condition>

</rule>

<sequence name="Auto Replay">

<operation name="LWJDBC Get list of failed arrived files">

<participant name="test_LWJDBC"/>

<output message="LightweightJDBCAdapterTypeInputMessage">

<assign to="." from="*"></assign>

<assign to="sql">SELECT a.ARRIVEDFILE_KEY as ARRIVEDFILE_KEY FROM FG_ARRIVEDFILE a WHERE a.STATE=&apos;Failed&apos; and a.REVIEWED=0</assign>

</output>

<input message="inmsg">

<assign to="Replay" from="DocToDOM(PrimaryDocument, &apos;false&apos;)//row"></assign>

</input>

</operation>

<assign to="loopcounter">1</assign>

<assign to="keycount" from="count(//row)"></assign>

<sequence name="LoopStart">

<choice name="MoreKeys">

<select>

<case ref="MoreKeys" activity="DoXAPI"/>

</select>

<sequence name="DoXAPI">

<operation name="XAPI Service">

<participant name="XAPIService"/>

<output message="XAPIServiceTypeInputMessage">

<assign to="." from="*"></assign>

<assign to="api">replayFgArrivedFile</assign>

<assign to="xml" from="concat(&apos;&lt;replayFgArrivedFile ArrivedFileKey=&quot;&apos;, Replay/row[number(/ProcessData/loopcounter)]/ARRIVEDFILE_KEY,

&apos;&quot; Comment=&quot;Bulk Replay&quot;/&gt;&apos;)"/>

</output>

<input message="inmsg">

<assign to="." from="*"></assign>

</input>

</operation>

<assign to="loopcounter" from="number(loopcounter)+1"></assign>

<repeat ref="LoopStart"/>

</sequence>

</choice>

</sequence>

</sequence>

</process>





For more information on the replayFgArrivedFile api as well as other available api, please consult the javadoc documentation that can be found under the product installation directory:

<SI_Install_Dir>\xapidocs\api_javadocs\index.html



In addition, check the link to the official XAPI service documentation provided below:

XAPI Service documentation





If you have any suggestions that can add value to this blog content, please leave a comment with your suggestion.

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SS3JSW","label":"IBM Sterling B2B Integrator"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

UID

ibm11122039