IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Flat Files > Overview of WebSphere Adapter for Flat Files > Technical overview > Outbound processing
Generate unique file names
To generate unique file names during Create operations, add a persistent sequence number to the default file name or use random numbers to generate file names.
There are two ways to generate unique file names during Create operations:
- Add a persistent sequence number to the default file name. This method is recommended, especially in a clustered environment.
- Use random numbers to generate unique file names without any persistence.
Generate unique file names using a persistent sequence number
To generate unique file names using a persistent sequence number, specify:
- The sequence file, which is the complete path of the file where the sequence numbers are stored
- The default target file name
The adapter generates a file name that consists of the default target file name with the sequence number appended to it.
By default, the sequence number starts from one and continues until the number 9223372036854775807. When this number is reached, the sequence number is reset and the numbering starts automatically from one.
The properties that control the generation of unique file names are present in three places:
- The managed connection factory properties (the Default target file name and Sequence file properties)
- The interaction specification properties (the Default target file name and Generate a unique file properties)
- The wrapper business object
The properties in the business object take precedence over the properties in the interaction specification, which take precedence over the managed connection factory properties. Unless you want to specify properties for individual business objects, use the properties in the managed connection factory to control the generation of file names.
If the default file name has an extension, the sequence number is appended before the extension.
For example, if the default file name is Customer.txt in the managed connection factory, the output file names created are Customer.1.txt, Customer.2.txt, and so on.
For each request, the adapter increments the number in the sequence file, and the input type takes the sequence number that is currently stored in the sequence file. Sequence numbers are not maintained separately for different input data types.
For compatibility with sequence files generated with previous versions of the adapter, where sequence numbers were maintained separately for different input data types, the adapter checks for all entries in the file that have the older format ( <dirPath>/Customer.txt = 2, where Customer.txt is the default file name and 2 is the sequence number to be used when the adapter receives another Create request on the same file). The adapter searches for all such sequence numbers for each input type and uses the highest sequence number as the sequence number for the next input type. The adapter then overwrites the entire file with the new (increments) sequence number.
Important: Unless they are part of a cluster, two adapter instances must not access the same sequence file, because it might result in delayed processing of batch requests.
Generate unique file names using random numbers
To generate unique file names using random numbers, set the GenerateUniqueFile property in the managed connection factory, interaction specification, or in the wrapper business object to true. When generating unique file names, you can specify a prefix and suffix (file extension) for the file name. This setting enables the adapter to generate file names that are unique but with a predefined prefix and suffix to its file name. For instance, if you specify the prefix as ffaa and the file extension as .abc, the adapter generates unique file names with the following format: ffaa[ RandomNumber].abc, where RandomNumber is the random number that the adapter generated.
For example, ffaa23423.abc.
Related concepts: