Axway Gateway: Managing Events

Decision Rule usage example: Directory Scanning

Task overview

Example production environment

Configuring the function

Results

Task overview

This topic provides an example of how to configure Gateway to scan a directory for a certain type of file.

You can create a Directory Scanning type Decision Rule so that Gateway monitors a specified folder on the host machine. You can then specify an action for Gateway to execute when it detects a file in this folder.

To configure Gateway to execute a process based on the presence of a file in a specified folder, perform the following tasks:

Example production environment

Operation

A company handles billing records from diverse machines on its network. Several billing terminals regularly send billing records to an accounting application on a centralized UNIX machine. The accounting application analyzes each incoming billing record and creates two types of report:

  • IntlReportNxxx.txt - concerning international accounts. These files are to be transferred and stored on SiteA.
  • NtlReportNxxx.txt - concerning national accounts. These files are to be transferred and stored on SiteB.

When the accounting application creates the reports it deposits them in the local folder: /usr/local/appli/report. When deposited to this folder, the files are in their final form and their contents are no longer modified.

Architecture

In this example:

  • The central accounting application and Gateway reside on the same UNIX host
  • Both International handling SiteA and National handling SiteB host Axway Transfer applications (Transfer CFT or Transfer InterPel)
  • Billing terminals communicate with the central accounting application independently of Gateway

The following figure illustrates the architecture of the example.

Configuring the function

Prerequisites

  • Gateway must be correctly installed and running on the same platform as the central accounting application.
  • Axway Transfer applications must be correctly installed and running on SiteA and SiteB machines.
  • You must have created the local and remote Sites necessary to enable transfers from the Gateway to the Axway Transfer sites. This example uses the following site aliases:
    • Gateway local site alias = GW_1
    • International processing server remote alias = SiteA
    • National processing server remote alias = SiteB
  • The machines must be linked by a TCP/IP connection.
  • You require a Windows environment to support the Gateway GUI.

Selecting the storage and work folder for Gateway monitoring

In this example, the folder we want to monitor is the folder that the central accounting application uses for report deposits:
/usr/local/appli/report.

Create the working folder in which Gateway processes files. In this example:
/usr/local/appli/work.

Note: The working folder and the watch folder must be on the same file system.

Creating the execution Models

In this example, we create Decision Rules that specify a Model as the execution type when a stored file is detected. We require two General Models: one for Transfers to the international processing server, and another for Transfers to the national processing server.

The General Model is mandatory for Transfers, since you can only define the Transfer destination in the General Model and not in a Protocol Model.

To create a new General Model for Transfers to the international processing server:

  1. In the Directory tree structure, click to expand the nodes:
  2. Transfer Management > Parameters > Model
  3. Right-click the Transfer Model sub-node, then select New from the context menu to display the New General Model window.
  4. Complete the fields of the New General Model window as follows.
    • In the Name field, enter: M_Trans_Intl_Report.
    • Use the Argument and Value fields to assign the following values:
  5. Argument

    Value

    type

    TRANS

    direction

    0 (output)

    mode

    I (initiator)

    file name

    &(file_name)

    file component

    &(dir_path)/&(file_component)

    application

    DEFAULT_B

    originator alias

    GW_1

    destination alias

    SITEA

  6. After entering the values, click OK.
  7. Gateway closes the New General Model window and adds an entry representing the new Model to the list in the Transfer Model display pane.

To create a new General Model for Transfers to the national processing server:

  1. In the Directory tree structure, click to expand the nodes:
  2. Transfer Management > Parameters > Model
  3. Right-click the Transfer Model sub-node, then select New from the context menu to display the New General Model window.
  4. Complete the fields of the New General Model window as follows:
    • In the Name field, enter: M_Trans_Ntl_Report.
    • Use the Argument and Value fields to assign the following values:
  5. Argument

    Value

    type

    TRANS

    direction

    0 (output)

    mode

    I (initiator)

    file name

    &(file_name)

    file component

    &(dir_path)/&(file_component)

    application

    DEFAULT_B

    originator alias

    GW_1

    destination alias

    SITEB

  6. After entering the values, click OK.
  7. Gateway closes the New General Model window and adds an entry representing the new Model to the list in the Transfer Model display pane.

Creating the Directory Scanning type Decision Rules

We require two Decision Rules: one for Transfers to the international processing server, and another for Transfers to the national processing server.

To create a Decision Rule for Transfers to the International processing server:

  1. In the left pane of the GUI main window, click to expand the Event Management node.
  2. Gateway displays the following sub-nodes:
    • Scheduling
    • Directory Scanning
    • Transfer Change State
    • XMS
  3. Right-click the Directory Scanning sub-node. A context menu appears. Select New > Decision Rule...
  4. Gateway displays the New Decision Rule window.
  5. In the New Decision Rule window, enter the following data:
  6. Field

    Enter the value...

    Description

    Name

    Trans_International_Report

    Unique name for the Decision Rule.

    Conditions

    Argument/ Operator/ Value

    file name = IntlReportN*.txt

    Name of the file to be transferred to the International processing server.

    Processing (if all conditions match)

    Execution type

    Model

    Execute a Model in the case of a match for this Decision Rule.

    Model

    M_Trans_Intl_Report

    Name of the Model to use to initiate a Transfer Request to the International processing server.

  7. After entering the values, click OK.
  8. Gateway closes the New Decision Rule window and adds an entry representing the new Decision Rule to the list in the Decision Rule display pane.

To create a Decision Rule for Transfers to the national processing server:

  1. In the left pane of the GUI main window, click to expand the Event Management node.
  2. Gateway displays the following sub-nodes:
    • Scheduling
    • Directory Scanning
    • Transfer Change State
    • XMS
  3. Right-click the Directory Scanning sub-node.  A context menu appears.  Select New > Decision Rule...
  4. Gateway displays the New Decision Rule window.
  5. In the New Decision Rule window, enter the following data:
  6. Field

    Enter the value...

    Description

    Name

    Trans_National_Report

    Unique name for the Decision Rule.

    Conditions

    Argument/ Operator/ Value

    file name = NtlReportN*.txt

    Name of the file to be transferred to the International processing server.

    Processing (if all conditions match)

    Execution type

    Model

    Execute a Model in the case of a match for this Decision Rule.

    Model

    M_Trans_Ntl_Report

    Name of the Model to use to initiate a Transfer Request to the International processing server.

  7. After entering the values, click OK.
  8. Gateway closes the New Decision Rule window and adds an entry representing the new Decision Rule to the list in the Decision Rule display pane.

Creating the Directory Scanning type Rule Table

For this example we create a Directory Scanning type Rule Table, linking the Decision Rules that we created in the previous section.

To create a Directory Scanning type Rule Table, follow these steps:

  1. In the left pane of the GUI main window, click to expand the Event Management node.
  2. Gateway displays the following sub-nodes:
    • Scheduling
    • Directory Scanning
    • Transfer Change State
    • XMS
  3. Right-click the Directory Scanning sub-node. A context menu appears. Select New then Rule Table....
  4. Gateway displays a New Rule Table window.
  5. In the General tab of the New Rule Table window, enter the following data:
  6. Field

    Enter the value...

    Description

    Name

    Acct_file_test

    Unique name for the Rule Table.

    Comments

    Table for accounting file transfer test

    Enter a free text description of the Rule Table.
    Maximum: 80 alphanumeric characters.

    Active

    Select this option.

    Activates the Rule Table.

    Exclusive table

    Select this option.

    Executes only the first Decision Rule that completely matches the criteria.

    Default execution type

    No action

    Specifies that no action is executed if no defined Decision Rule matches the current parameters.

    Log level

    None

    Deactivate logging.

  7. In the File Event tab of the New Rule Table window, enter the following values.
  8. Field

    Enter the value...

    Description

    Watch Directory

    /usr/local/appli/report

    Path to the directory you want Gateway to supervise (or poll) to determine the presence of a file.

    Watch period

    20

    Time cycle (in seconds) for polling repetitions.

    Work directory

    /usr/local/appli/work

    Path to the work directory.

    When Gateway polls the Watch Directory and locates a file, it transfers the file to the Work directory before beginning file processing.

    Optimized cleaning

    Select this option.

    Enables Gateway to periodically delete a part of the contents of the Work Directory contents.

  9. In the Linked rules tab of the New Rule Table window, in the Available Rules list:
    • Click Trans_International_Report to select it. Then click the Link button.
    • Click Trans_National_Report to select it. Then click the Link button again.
      Gateway links the two Decision Rules to the Acct_file_test Rule Table.
    • Click OK to validate the new Rule Table.
  10. Gateway closes the New Rule Table window and adds the Acct_file_test entry to the display of Rule Tables and Decision Rules for the Directory Scanning category.

Results

When you have created and activated the Decision Rules and linked them to a Rule Table as described above, Gateway scans the /usr/local/appli/report folder every 20 seconds for the presence of a file.

The presence of one or more files triggers the copy of the file(s) to the work folder. Gateway then extracts the information necessary to analyze the Rule Table for Decision Rule criteria matches. If Gateway finds a match, it deposits the appropriate Transfer Model and transfers the file to the specified server.

After execution of the Transfers, the original files are periodically purged from the work folder.

 

Links to documentation set for Axway Gateway 6.17.3:

Related Links