SimpleRecord Project
The SimpleRecord project contains two adapter configurations: delimitedReader.adfilesmodel and delimitedWriter.adfilesmodel. The sample project shows how the adapter transfers records.
- In delimitedReader.adfilesmodel, Publication Service parses the
delimited.txt file and sends the content in a series of messages. After processing all lines in the input file, Publication Service exits.
To enable Publication Service to parse the delimited.txt file, the service is configured as follows: the Life Cycle field is Once-only, so the service reads the file only once, and exits after sending messages. The Input Directory, Recognition Method and File Name fields indicate the directory that contains the input file, how to select the file and the file name. The service uses the Reliable quality of service and publishes the messages using ActiveEnterprise message semantics.
Three delimited file records are defined for parsing each type of line found in the delimited.txt file: Order, Item and Customer. Take the Order file record for example, the Strip Blanks and Repeating Delimiter check boxes are selected, so blank spaces between fields on the order line are removed, and if any repeated delimiter characters exist between fields, the repeated characters are ignored. The line is identified by a field value. The value is identified by the value of the Constant column. The parent line and child lines to be published are identified in a read schema. The read schema indicates that the Order file record represents the parent line and the Item and Customer file records represent child lines. The read schema is associated with Publication Service in the Schema tab.
- In delimitedWriter.adfilesmodel, Subscription Service receives all messages, formats and writes them to an output file located in a working directory. One minute after opening the file, the service moves the file to its output directory and renames the file using a timestamp. Each time you run Publication Service, another output file is created in the output directory and named using a timestamp.
To enable Subscription Service to receive and format messages, the service is configured as follows: the Wip Creation Mode field is Append the messages to file, close on timer. The quality of service and wire format are configured the same as that for Publication Service. The location of the working and output directories are specified in the Processing tab.
A write schema is defined for the service to include the ActiveEnterprise classes created by Publication Service. After the schema is defined, write file records are automatically created, one for each class found by the write schema. The write file records are defined in this way so that the Customer line is written under the Item line.
The Customer write file record is modified so that a tab is used as the delimiter character. The Item and Order write file records are modified with a semicolon as the delimiter character. The write schema is associated with Subscription Service in the Schema tab.