SFG Static Route, Dynamic Route, Custom Layer and Custom Protocol

This document will explain how to create a simple Custom Layer, Custom Protocol and Dynamic Route. All of them will run the same BP, that will do only Translation of the input file. This is for comparing different options for processing an input file, and see how and where translation is handled as well as how it will be reported in the case of errors.
Static route example is also included, but it is not so important as static route normally do not do anything (any processing) with the file.
This is the flow that shows how the file, depending on its name, will be routed and processed:

- Input File
input-des-21.des (this is just for my reference, can be any input you want)
- Map
PRES_map_inhouseToDESADV.map (can be any map that translates the input file)
- Business Process (that will be used in custom layer, custom protocol and dynamic route)
VDC_SFG_translation.bp
<process name="default">
<sequence name="mainStart">
<operation name="Translation">
<participant name="Translation"/>
<output message="TranslationTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="map_name">PRES_map_inhouseToDESADV</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="FileGatewayRouteEventServiceType">
<participant name="FileGatewayRouteEventService"/>
<output message="FileGatewayRouteEventServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="." from="RouteEntityType"></assign>
<assign to="." from="RouteEntityKey"></assign>
<assign to="." from="RouteMetaData"></assign>
<assign to="." from="RouteDataflowId"></assign>
<assign to="EventCode">CUST_0001</assign>
<assign to="EventAttributes/test">PRES_map_inhouseToDESADV.map</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<onFault>
<sequence name="errorStart">
<operation name="FileGatewayRouteEventServiceType">
<participant name="FileGatewayRouteEventService"/>
<output message="FileGatewayRouteEventServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="." from="RouteEntityType"></assign>
<assign to="." from="RouteEntityKey"></assign>
<assign to="." from="RouteMetaData"></assign>
<assign to="." from="RouteDataflowId"></assign>
<assign to="EventCode">CUST_0051</assign>
<assign to="EventAttributes/test">PRES_map_inhouseToDESADV.map</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</onFault>
</sequence>
</process>
- Custom Events
Two custom events, used in the previous BP (CUST_0001 and CUST_0051), will be defined in customer_overrides.properties. CUST_0001 is to mark successful translation and CUST_0051 is for failed translation.
My Example for custom events in customer_overrides.properties:
#Event Codes for BP that will be used in dynamic route, custom layer and custom protocol
filegateway_eventcodes.CUST_0001.name=Translation in custom layer/protocol/route successful
filegateway_eventcodes.CUST_0001.attributes=ProducerName,ConsumerFilename
filegateway_eventcodes.CUST_0001.text=File {0} translated
filegateway_eventcodes.CUST_0001.description=Message Translation - PASSED
filegateway_eventcodes.CUST_0001.permissions=producer,consumer,subscription
filegateway_eventcodes.CUST_0051.name=Translation in custom layer/protocol/route Failed
filegateway_eventcodes.CUST_0051.attributes=ProducerName,ConsumerFilename
filegateway_eventcodes.CUST_0051.text=File {0} NOT translated
filegateway_eventcodes.CUST_0051.description=Message Translation - FAILED
filegateway_eventcodes.CUST_0051.permissions=producer,consumer,subscription
- Custom Protocol
- Add a protocol in AFTExtensionsCustomer.xml (copy AFTExtensions.xml)
[installFolder]\install\container\Applications\aft\WEB-INF\classes\resources\xml\ AFTExtensionsCustomer.xml
<AFTExtensions>
….
<!—adding custom protocol for translation à
<AFTExtension name="translation-protocol" type="consumer-delivery-protocol" label="translation.protocol.label.translationprotocol" bp="VDC_SFG_translation">
<GROUP title="translation.instance.group1.title">
<VARDEF varname="MapName" type="String" htmlType="text" label="translation.label.translationprotocol.mapname" size="30" maxsize="250" validator="ALPHANUMERIC" required="yes"/>
</GROUP>
</AFTExtension>
</AFTExtensions>
- Add labels for the protocol in AFTExtensionsCustomer.properties (copy of AFTExtensions.properties)
[installFolder]\install\container\Applications\aft\WEB-INF\classes\resources\AFTExtensionsCustomer.properties
#######################################################
# Translation custom protocol
#######################################################
translation.protocol.label.translationprotocol = Translation Delivery
translation.instance.group1.title = Translation Delivery
translation.label.translationprotocol.mapname = Map Name
Stop Sterling File Gateway.
Run <install_dir>\bin\setupfiles.sh.
Run <install_dir>\bin\deployer.sh.
Start Sterling File Gateway.
Note: Once when custom protocol has been added, you must add it to Community first (that Partner belongs to) and a new partner will see a new protocol.
- Custom Layer
Input for creating a custom layer:
<MultiApi>
<API Name="manageFgProducerFileLayerType">
<!-- This API affects the second Producer File Layer Type
and the Parameter types associated with it. See the
FG_P_FLR_TYPE, FG_P_FLR_PRM_TYPE, and FG_P_FLR_TRANS
table information below. -->
<Input>
<FgProducerFileLayerType ContainsName="N" Description="Translation" DisplayLabel="Translation" IsContainer="N" LayerType="FGC_TXNCN" ProducerFileLayerTypeKey="TXPNCN_GUID">
<FgProducerFileLayerParameterTypeList TotalNumberOfRecords="2">
<FgProducerFileLayerParameterType DefaultValue=".+" Description="File name pattern as regular expression" DisplayLabel="File name pattern" DisplayType="String" Ordinal="0" ParameterName="FILENAME_PATTERN" ProducerFileLayerParameterTypeKey="TXPNCN_P1_GUID" ProducerFileLayerTypeKey="TXPNCN_GUID"/>
<FgProducerFileLayerParameterType Description="File name pattern group fact names,
comma delimited" DisplayLabel="File name pattern fact names" DisplayType="String" Ordinal="1" ParameterName="FILENAME_PATTERN_FACTNAMES" ProducerFileLayerParameterTypeKey="TXPNCN_P2_GUID" ProducerFileLayerTypeKey="TXPNCN_GUID"/>
</FgProducerFileLayerParameterTypeList>
</FgProducerFileLayerType>
</Input>
</API>
<API Name="manageFgConsumerFileLayerType">
<!-- This API affects the second Consumer File Layer Type
(non-container type) and the Parameter types associated
with it. See the FG_C_FLR_TYPE, FG_C_FLR_PRM_TYPE, and
FG_C_FLR_TRANS table information below.
-->
<Input>
<FgConsumerFileLayerType ConsumerFileLayerTypeKey="TXCNCN_GUID" Description="Translation" DisplayLabel="Translation" IsContainer="N" LayerType="FGC_TXCNCN">
<FgConsumerFileLayerParameterTypeList TotalNumberOfRecords="2">
<FgConsumerFileLayerParameterType ConsumerFileLayerParameterTypeKey="TXCNCON_P1_GUID" ConsumerFileLayerTypeKey="TXCNCN_GUID" DefaultValue="${ProducerFilename}" Description="File name format" DisplayLabel="File name format" DisplayType="String" Ordinal="0" ParameterName="FILENAME_FORMAT"/>
<FgConsumerFileLayerParameterType ConsumerFileLayerParameterTypeKey="TXCNCON_P2_GUID" ConsumerFileLayerTypeKey="TXCNCN_GUID" Description="Map Name" DisplayLabel="Map Name" DisplayType="String" Ordinal="1" ParameterName="Map_Name"/>
</FgConsumerFileLayerParameterTypeList>
</FgConsumerFileLayerType>
</Input>
</API>
<API Name="manageFgConsumerFileLayerTranslation">
<Input>
<FgConsumerFileLayerTranslation BusinessProcessName="VDC_SFG_translation" ConsumerFileLayerTranslationKey="TXCTRAN1_GUID" ConsumerFileLayerTypeKey="TXCNCN_GUID" ProducerFileLayerTypeKey="TXPNCN_GUID"/>
</Input>
</API>
</MultiApi>
This file is an input for XAPI Service and api action is multiApi. After running that service, custom layer will be added in SFG:
<process name="VDC_SFG_XAPI">
<sequence>
<operation name="XAPI Service">
<participant name="XAPIService"/>
<output message="XAPIServiceTypeInputMessage">
<assign to="." from="*"/>
<assign to="api">multiApi</assign>
</output>
<input message="inmsg">
<assign to="." from="*"/>
</input>
</operation>
</sequence>
</process>
I will show
· Routing Channel Templates
· Routing Channels
· Arrived File Events
· Route Events
· Delivery Events
· Message in a MBX (dashboard interface)
· Consumer's file in myFileGateway
· Error in BP used for processing, shown in filegateway and dashboard interface
... for the following routing and delivery scenarios:
· Static Route
· Dynamic Route
· Custom Layer and
· Custom Protocol