Version: 17.07
Supported Since: 17.01
UltraESB-X message has four main parts. They are payload, headers, properties and attachments. Attachments can be used to carry any additional information with the message. Note that attachment is set to the message and not to the message context. Therefore once the life cycle of the message ends, attachments' life cycle also ends. Basically when a message is sent out using an Egress Connector or when the flow ends with one of Flow End elements (see Successful Flow End and Exceptional Flow End), the message’s life cycle ends and same is applied to the attachments of the message. Attachment does not get automatically sent out when the message is sent out through an Egress Connector. It has to be manually processed to send it out either through a Custom Processing element which sets the payload by processing attachments or through an Egress Connector that supports sending out attachments.
An Attachment Saver is a processing element which can be used to save an attachment from the message to a file in local file system.
In order to use this processing element, you must first select the Attachment Processor dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Attachment Processor dependency. Alternatively, you can add the following dependency to the maven pom.xml manually.
|
Next |
The message will be sent to this outport if the attachment saving operation is successful |
On Exception |
The message will be sent to this outport if the processing element failed in saving attachment to file |
Attachment Name Regex* |
Basic |
Attachment name regex parameter can be used to give a Regex Pattern to match the names of the attachments needed to be saved.
|
||
Directory Path* |
Basic |
Directory Path represents the local file system path to save the attachment. Following place holders can also be used when giving the directory path. Relevant values for the place holders will be extracted from the message context.
Few examples are as follows.
Further following place holder can be used to get the current timestamp.
|
||
Use Attachment Name as File Name |
Basic |
Boolean parameter to set whether to use the attachment name as the file name or whether to give a different file name using the optional File Name parameter. Default value of this parameter is true. Therefore by default attachment name will be used as the file name when saving attachment payload to file.
|
||
File Name |
Basic |
File Name parameter can be used optionally to give a file name to save the attachment payload. Note that to use this value as the file name when saving the attachment "Use Attachment Name as File Name" boolean parameter should be set to false. Following place holders can also be used when giving the file name. Values for the place holders will be extracted from the message context.
Few examples are as follows.
Further following place holder can be used to get the current timestamp.
|
In the following use case we have a flow which starts with a Mail Ingress Connector and ends with a Successful Flow End element. In the middle first we have used a Payload Attacher to set payload as an attachment and next we use the Attachment Saver to save the attachment to a file. Complete flow for the use case is shown below.
Configuration for the attachment saver element is as follows.