Components > File listeners > Configuring a file listener
  

Configuring a file listener

Before you create file listeners, verify that the following conditions exist:
Perform the following steps to configure a file listener:
    1. To create a file listener, click New > Components > File Listener, and then click Create.
    To edit a file listener, on the Explore page, navigate to the file listener. In the row that lists the file listener, click Actions and select Edit.
    When you edit a file listener, such as update the run-time environment, connector type, connection, or listener rule properties, the file listener requires a reset. A warning message appears. Click Ok to continue. This action clears the list of previously tracked files.
    2. Configure the following file listener details:
    Parameter
    Description
    File Listener Name
    Name of the file listener. A file listener name must be unique within the organization. File listener names can contain alphanumeric characters, spaces, and underscores. The names must begin with an alphabetic character or underscore.
    File listener names are not case sensitive.
    Location
    Project directory in which the file listener is created.
    Description
    Optional description of the file listener. Maximum length is 1024 characters.
    Status
    Status of the file listener: Enabled or Disabled. A disabled file listener does not listen to files on the designated folder.
    Runtime Environment
    Runtime environment that contains the Secure Agent used to run the file listener.
    Source Type
    Type of source to which file listener listens. Select one of the following source types:
    3. Configure the schedule by which the file listener runs:
    Parameter
    Description
    Run
    Frequency at which the file listener runs, daily, weekly, or monthly.
    Start Date
    Date on which the file listener starts running.
    End Date
    Date until which the file listener runs.
    Repeat indefinitely
    The file listener runs without an end date.
    Start At
    Time of day when the file listener starts running.
    Check Until
    Time of day when the file listener stops running.
    Check Every
    Frequency at which the file listener checks for files in the folder to which it listens, by seconds, minutes, or hours.
    Time Zone
    Time zone according to which the file listener runs.
    Days to Run
    Days of the week when the file listener runs when you select to run the file listener weekly.
    Day of Month
    Day of the month when the file listener runs when you select to run the file listener every month.
    Day of Week
    Day of the week the file listener runs when you select to run the file listener every month
    Week
    The week the file listener runs when you select to run the file listener every month. For example, to run the file listener on the fourth Sunday of the month, select Day of Week: Sunday and Week: Fourth.
    4. Under Failure Management, you can select the following options:
    5. Click Save.

Configuring file listener for a server source type

When you select the source type as server in the file listener details, file listener listens to the server events.
You can configure a file listener to listen to events on AS2, HTTPS, and SFTP servers. For example, you can configure the file listener to send notification when the AS2 server receives a file. For more information about configuring file listener details, see Configuring a file listener.
Configure the following parameters and the file listener rules when you select a server source type:
    1. Configure the following parameters to define the events that file listener listens:
    Parameter
    Description
    Event Provider
    The server type to which the file listener listens. You can configure the file listener to listen to the AS2, HTTPS, or the SFTP server.
    Event Type
    The type of server event to which file listener listens. The event types that you can define for the AS2 server are:
    • - AS2 Message Receive Failed
    • - AS2 Message Receive Successful
    The event types that you can define for the HTTPS server are:
    • - HTTPS Upload Failed
    • - HTTPS Upload Successful
    The event types that you can define for the SFTP server are:
    • - SFTP Upload Failed
    • - SFTP Upload Successful
    For example, if the event type is SFTP Upload Failed, then file listener sends notifications when the file upload fails on the SFTP server.
    2. Configure the following parameters to define listener rules:
    Parameter
    Description
    Key
    The event attributes.
    Type
    The methods to filter the key value.
    • - Contains. Filters keys that contain the value.
    • - Equals. Finds an exact match to run the rule.
    Value
    Value of the key.

Configuring file listener for a connector source type

When you select the source type as connector in the file listener details, the file listener listens to the connection.
For more information about configuring file listener details, see Configuring a file listener.
    1. Configure the following parameters to define the connection:
    Parameter
    Description
    Connection Type
    Type of the connection to which the file listener listens.
    Connection
    Connection to which the file listener listens.
    2. Configure the following parameters to define listener rules:
    Parameter
    Description
    Folder Path
    Path to the folder to which the file listener listens.
    Note: File listener can access files and directories on network shares with support for NFS and CIFS.
    Pattern Type
    Determines the pattern of the file name to which the file listener listens. Select one of the following patterns:
    • - Wildcard
    • - Regex
    • - Indicator File
    File Pattern
    File name pattern to which the file listener listens.
    • - Wildcard. Use wildcard patterns of file name.
    • - Regex. Use a regular expression to match the file name pattern.
    • If you select regex pattern type, consider the following examples:
      • - Use the following syntax to listen to all files except for files whose name contains out, foo, and baz. ^(?!.*(?:out|baz|foo)).*$ all except
      • - Use the following syntax to listen to all files that have an extension of doc,docx, pdf. ([a-zA-Z0-9\s_\\.\-\(\):])+(.doc|.docx|.pdf)$
      • - Use the following syntax to listen to all text file except for files whose name contains out.txt. ^(?!out).*\.txt$
    • - Indicator File. Use the file name to which the file listener listens.
    Check for files in sub-folders
    Indicates whether the file listener checks for files in sub-folders under the folder to which it listens.
    Post Action
    Determines the action the file listener must perform after the file listener listens to the events.
    You can select the post action as Delete only if the file pattern is an indicator file. Default is None.
    The following connection types support the Post Action option:
    • - Local folder
    • - Advanced FTP V2
    • - Advanced FTPS V2
    • - Advanced SFTP V2
    • - Azure Data Lake Store Gen2
    Add Parameters
    Create an expression to add it as a folder path parameter. For more information, see Add Parameters.
    Notify when file
    Determines when the file listener must send notifications to the services that are registered to it:
    • - Arrived. Sends notifications when files arrive at the folder to which the file listener listens.
    • - Updated. Sends notifications when files in the folder to which the file listener listens are updated.
    • - Is Deleted. Sends notifications when files in the folder to which the file listener listens are deleted.
    You can select as many options as required.
    Note: Do not select the Is Deleted option if the Post Action is Delete.
    Stop checking if rules are met
    The file listener stops listening to the folder when the listener rules are met. For example, if you configure the file listener to send notifications when the files in the folder to which it listens are deleted, the listener stops listening to the folder when the first event of file deletion occurs in the folder.
    If this option is not selected, the file listener notifies the registered application on events and continues to listen for subsequent events.
    Check File stability
    The file listener verifies that the entire file is copied to the folder to which it listens before notifying the registered services.
    Tip: Select this option if you transfer large files, where the process of writing the files to the folder is not instant.
    Stability Check Interval
    Time in seconds that a file listener waits to check for file stability. For example, if the stability time is 15 seconds, a file listener verifies the status of the file after every 15 seconds.
    The stability check interval field is enabled only if you select the Check file stability option.
    The stability check interval ranges between 10 seconds to 300 seconds. Default is 10 seconds.
    Notify if files exist on the first run
    When the file listener runs for the first time, it sends a notification if files exist in the folder to which it listens. The Exclude events when the file listener is not running option is disabled when you select this option.
    Exclude events when the file listener is not running
    Determines if you want to exclude the file events that occur when a file listener is not running. The Notify if files exist on the first run option is disabled when you select this option.

Add Parameters

Using variables you can configure a parameter that a file listener reads from or writes to.
You can use one of the following types of variables to configure a parameter:
Note: You cannot run a task using the user-defined variable from the user interface. The value of the user-defined variable must be passed using the job resource of the Mass Ingestion Files REST API. For more information, see the REST API help.
Using system variables to add parameters
Use system variables to add parameters to Folder Path on the task wizard.
    1. Click the icon next to Post Action on the file listener task wizard.
    The Add Parameters window appears.
    Select the system variables from the Add Parameters window.
    2. Select the required variable from the System Variablescolumn, and click . The selected system variable appears on theExpression column. Repeat this procedure to select multiple system variables.
    Note: When using a System variable within a task, it should be formatted as ${systemvariablename}.
    The following table describes the system variables:
    System Variables
    Description
    Expression
    BadFileDir *
    Directory for reject files. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMBadFileDir}
    CacheFileDir *
    The location for the cache file.
    ${$PMCacheDir}
    Date **
    The current date in ISO (yyyy-MM-dd) format.
    ${system.date}
    Day **
    The day of week
    ${system.day}
    ExtProcDir *
    Directory for external procedures. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMExtProcDir}
    LookupFileDir *
    Directory for lookup files. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMLookupFileDir}
    Month **
    Numerical month
    ${system.month}
    RootDir
    Root directory accessible by the node. This is the root directory for other service process variables. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMRootDir}
    SessionLogDir *
    Directory for session logs. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMSessionLogDir}
    StorageDir *
    Directory for run-time files. Workflow recovery files save to the $PMStorageDir configured in the PowerCenter Integration Service properties. Session recovery files save to the $PMStorageDir configured in the operating system profile. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMStorageDir}
    TargetFileDir *
    Directory for target files. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMTargetFileDir}
    TempDir *
    Directory for temporary files. It cannot include the following special characters:
    * ? < > " | ,
    ${$PMTempDir}
    WorkflowLogDir *
    The location for the workflow log file.
    ${$PMWorkflowLogDir}
    Year **
    Year
    ${system.year}
    * Values are fetched from the Data Integration Server.
    ** Time zone is the Secure Agent time zone.
    Note: The parameter substitution occurs when you start a task. When a file listener starts and evaluates that the previously watched location is different due to the difference in the parameter value, a delete notification is sent for the files present in the previously watched location. The notifications are not sent if you disable the delete notification option or enable the Exclude events when the file listener is not running option.
    3. Click OK.
    The expression appears in the Folder Path field.

Using user-defined variables to add parameters

Use user-defined variables to define value for Folder Path on the task wizard.
    1. Click the Folder Path field and enter the variable. The variable should be formatted as ${systemvariablename}.
    2. Click OK.
    The expression appears in the Folder Path.