attachment remover

Attachment Remover

Version: 17.07

Supported Since: 17.01

What is an Attachment Remover?

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 Remover is a processing element which can be used to remove an attachment from the message by simply providing the attachment name.

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.

attachment remover outports

Out Ports


The message will be sent to this outport if the attachment removing operation is successful

On Exception

The message will be sent to this outport if the processing element failed in removing attachment


Attachment Name Regex*


Attachment name regex parameter can be used to give a Regex Pattern to match the names of the attachments needed to be removed.

For example say you have attachments, attachment-1.csv, attachment-2.csv and attachment-3.csv. Now if you want to remove all the above attachments you can use the regex, attachment-\d.csv. Say you only need to delete "attachment-2.csv" from the above, then you can simply give that name attachment-2.csv to the parameter.

The fact that Attachment Name Regex accepts a regex does not prevent you from simply giving a plain text attachment name as input for that parameter.

Sample Use Case

To demonstrate a use case for attachment remover we will use very much the same flow used in Payload Attacher with the added Attachment Remover processing element to remove the attachment once the aggregation work is complete. Sample flow is as follows.

attachment remover flow

Configuration for the attachment remover element is as follows. To remove a previously added attachment, we refer the attachment to be removed through the Attachment Name Regex parameter. Notice that here for the Attachment Name Regex we have given the same value which was given in Payload Attacher element when adding the attachment.