Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

File Connector Guide

File Connector Guide

Example Process with File Connector

Example Process with File Connector

The following example illustrates one way you can use the File Connector to read delimited content, convert it to a list of process objects, call a service to make a list of phone numbers and publish the record count to the client.
First
, configure the Connection:
  1. Define the basic connection properties and select File as the Connection Type. Be sure to select an agent where the connection will run.
  2. On the Event Sources tab, add a Delimited Content Writer event.
  3. Enter a name and be sure to enable the event source if you want the connection to be available as soon as you publish it. If you do not want the connection to be immediately available, you can disable it.
  4. Specify the directory that should be monitored. This field is required. You can specify other optional properties to exclude or include specific files or the subdirectories.
  5. Enter other file parsing options as needed.
  6. Select No for Use Built-In Process Objects and, for Custom Object, enter a comma-delimited list of header names that are exactly the same as the names of the headers in the delimited file header you are reading. For example:
    Name,Street,City,State,PostalCode,Country,Phone
  7. Select any optional File Read Lock Settings you want to use. The Other Attributes field allows you to specify other parameters supported by the Apache Camel File Listener but not exposed in the File Connector.
  8. Save, test, and publish the process.
Second
, create the Process:
  1. Create a process and be sure it runs on the same Secure Agent defined in the connection.
  2. On the Start tab, select the connection, DelimitedContent, to automatically make the input field available that will hold the file content when the connection detects a new file in the monitored directory.
  3. Create two temporary variables in the process properties so you can iterate through the delimited content in the file:
    1. One to hold the full set of records. For example, TempIterator.
    2. One to hold each object as you iterate through the file. For example, TempCurrent.
  4. Create an Assignment step to assign the file records (process objects list) to the TempIterator field.
  5. Create an Assignment step to populate the current record from the list into a temporary variable, TempCurrent. Specify Formula as the source of TempCurrent, and use the following to get the first record:
    list:head($temp.TempIterator)
  6. Add a Decision step to validate that the record is set.
  7. In the Is set branch, perform the functions you need to process the data. This example makes a service call to RequestBin, passes in each record read from the file, and the service generates a list of phone numbers.
  8. Add an Assignment step to remove the processed record from the list of process objects. Specify Formula as the source of TempIterator, and use the following:
    list:remove($temp.TempIterator,1)
  9. Add a Jump step to loop back to the Assignment step that populates TempCurrent and get the next record from the process object.
  10. In the Unset branch, this example calls a service to publish the record count to the client, reading the FileInfo from the process object.
  11. End the process.

0 COMMENTS

We’d like to hear from you!
Luke Ferris - March 27, 2024

I've just worked through setting this up there appears to be some useful information missing from this example.

When creating the temporary variables at step 3, the variable types should be set as follows:

TempIterator [Connection defined types, your recently configured connector] DelimitedContentParserRecord (with 'Allow a list of objects of this type' selected)

TempCurrent [Connection defined types, your recently configured connector] DelimitedContentParserRecord

DelimitedContentParser is the default event name set at step 3 in the connection setup. Replace DelimitedContentParser with your event name when setting the temporary variable types.

At step 4, when assigning the process objects list to the TempIterator, the variable is set from the Field 'delimitedContent.File_record'.

Informatica Documentation Team - March 27, 2024

Hi Luke,

We’re working to address your comments and will get back to you.

Thanks,

Informatica Documentation team