writeFiles

Processor that produces files over different protocols.

The target file name can be specified in the following ways:

  1. The optional configuration property outputFileName.

  2. The original file name from the exchange property fileName if outputFileName is not set.

  3. An auto-generated file name if none of the above are set.

To avoid consumers reading in-progress files, atomic writes are supported by writing to temporary files that are renamed to the target file names once the writes finish. To enable this feature, the optional configuration property outputTempFileNameExpr is required together with a predefined target file name, either by setting outputFileName or the exchange property fileName explicitly.

outputTempFileNameExpr is an expression evaluated in the standard expression context with the property targetFileName added to the context.

The temp file name must not match any patterns used for consuming the target files. It’s recommended to include the targetFileName in the expression to keep it unique. For example, given a target file named ../path/target.xml:

  • The expression targetFileName + '.tmp' would result in a temp file name of ../path/target.xml.tmp.

  • The expression 'tmp/' + targetFileName would result in a temp file name of ../path/tmp/target.xml.

Properties

Name Summary

protocol

The FileTransferProtocol to use. Can be one of the following:

  • SFTP

  • FILE (Note: FILE protocol is disabled for security reasons. Must be enabled manually if needed on a specific platform instance.)

host

Host name or IP. Not relevant for FILE protocol.

port

Port to override the default. Not relevant for FILE protocol.

authenticationConfigKey

A secret key that the server uses to look up the credentials needed to perform the authentication. Not relevant for FILE protocol.

path

Location where the file is written. The last element of the path must be a directory.

outputFileName

Name to use when creating the files. Optional.

outputTempFileNameExpr

Temporary file name to use before the file write is complete. The name is evaluated from an expression. Optional.

autoCreate

Whether parent directories of the file to write are created automatically if they are missing. Optional and true by default.

writeTimeoutMillis

How long the processor will wait for a successful file creation.

forwardInput

Whether written files should be passed to the output of the processor. Defaults to false (i.e., file is not forwarded to the output).

name

Optional, descriptive name for the processor.

id

Required identifier of the processor, unique across all processors within the flow. Must be between 3 and 30 characters long; contain only lower and uppercase alphabetical characters (a-z and A-Z), numbers, dashes ("-"), and underscores ("_"); and start with an alphabetical character. In other words, it adheres to the regex pattern [a-zA-Z][a-zA-Z0-9_-]{2,29}.

exchangeProperties

Optional set of custom properties in a simple jdk-format, that are added to the message exchange properties before processing the incoming payload. Any existing properties with the same name will be replaced by properties defined here.

retainPayloadOnFailure

Whether the incoming payload is available for error processing on failure. Defaults to false.

Sub-builders

Name Summary

processingStrategy

Strategy for providing message processing hints to the server. Optional.

externalSystemDetails

Strategy for describing the external system integration. Optional.

circuitBreakerStrategy

Strategy for configuring the processor’s circuit breaker. Optional.

messageLoggingStrategy

Strategy for describing how a processor’s message is logged on the server.

payloadArchivingStrategy

Strategy for archiving payloads.

inboundTransformationStrategy

Strategy that customizes the conversion of an incoming payload by a processor (e.g., string to object). Should be used when the processor’s default conversion logic cannot be used.

Details

Authentication

The authenticationConfigKey property supports secrets of type UserNameAndPassword and SshPrivateKey. See the Secret Types documentation for formatting details.