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 > Outbound operations

Create operation

The Create operation creates a file with the specified name. You can modify the file name by specifying different properties.

For example, you can attach a sequence number to the file.

If you select the Enable response type for the operation check box in the external service wizard, the file name is returned to the component in a business object. If a file with the specified name exists, the adapter generates a DuplicateRecordException error, and no file is created.

If a staging directory is specified in the StagingDirectory property, the file that is to be created is copied from the output directory to the staging directory, and the content is written for that file in the staging directory. The file is then moved back to the output directory. If a staging directory is not specified, the content is written on the file in the output directory.

You can configure a staging directory only if the file content is to be written before the Create operation returns the resultant values. You cannot use a staging directory if the Create operation returns an output stream and the component writes to this stream.


Generate unique file name during Create operation

You can configure the adapter to generate a unique file name in the wrapper business object during run time. If you specify the GenerateUniqueFile property as True in the wrapper business object, the adapter generates a unique file name and ignores the value specified in the Filename property. The name of the unique file that is generated by the adapter is in the form of a random number. You can specify a prefix and suffix (file extension) for the file name.

For example, a file name with an abcd prefix and a suffix of .xyz, can be: abcd23423.xyz, where 23423 is the randomly generated number by the adapter.

You can also specify a staging directory, when configuring the adapter to generate a unique file name during the Create operation.

The adapter selects the values for the unique file name by using the following order of precedence:

Specify a minimum of three letters for the prefix. If you do not specify the prefix and suffix for the unique file name, the adapter uses ffa as the prefix and .tmp as the file extension during the unique file name generation.

If you do not specify the GenerateUniqueFile property at the wrapper level, the adapter sets the value as False and does not generate a unique file name.


Sequence file

The adapter appends a sequence number to the output file name to create a sequence file along with the output file.

For example, if the output file name in the request is Customer.txt, a file with the name Customer. n.txt is created, where n is the sequence number for the request. If another request with an output file name of Order.txt is received, the sequence number increments by 1 and Order.n+1.txt is generated.

If the FileSequenceLog managed connection property is specified, the adapter appends a sequence number to the output file name specified in the request and the next request uses the sequence number in the sequence file.

No new sequence number is created for each individual file name. If the output file name does not have an extension, the sequence is appended at the end of the file name.

For example, if the output file name in the request is Customer, a file with the name Customer n is created.

To avoid setting the output directory and file name in the business object for each request, you can generate file sequencing for a particular type of request by setting the output directory and file name at the managed connection level. When the adapter receives a request to create a file, it checks the file sequence log to see whether a file with that name exists. If one does, the adapter uses the file sequence number to create a file name.

The directory path and file name specified in the business object take precedence over the managed connection property values.

In a clustered environment, an environment in which you have one instance of the adapter running on several systems, the sequence file specified by the FileSequenceLog property must be on a mapped drive that is accessible by all the nodes in the cluster. The adapter must have write permission for the sequence log file, or an IOException error is returned.

In Windowss, such as, Windows 7, Windows Vista, and Windows Server 2008, there are issues faced in the mapped drive connection. Due to this issue, in a clustered environment, where the nodes are running on different machines, the files in the mapped event directory might not be processed correctly during outbound operations. For more information about working with mapped drives, refer to articles on mapped drive connection to network sharing, for your operating system.

If the FileSequenceLog property is specified and the GenerateUniqueFile property is enabled, the GenerateUniqueFile property takes precedence over the FileSequenceLog property. The sequence number will continue to increment after an adapter restart. If the sequence file is deleted manually, the sequencing starts again from 1.

Outbound operations


Related concepts:

Generate unique file names