Version: 17.07
Supported Since: 17.01
A String Appender is a processing element which can be used to append/prepend strings and store the resulting string as a scope variable. This element has two modes the normal node and the advanced mode. In the normal mode what it allows is to extract a value such a transport header, a message property or a scope variable from the message context, then append a given string into it and finally store the resulting string as a scope variable.
In this advanced a string append template can be given with a set of expressions or placeholders which relate data in the message context and the template will be used to compose the final string replacing the placeholders with relevant values from message context at runtime. One advantage of the advanced mode is that it supports appending/pre-pending multiple elements unlike the normal mode which only supports just two elements. Another advantage of the advanced mode is that it supports more data to be extracted from message context to compose the string along with the set supported in normal mode. More details about the advanced mode can be found under description of the string append template in the Parameters section.
In order to use this processing element, you must first select the String Processors 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 String Processors 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 string appending operation is successful |
On Exception |
The message will be sent to this outport if the processing element failed in string appending operation |
Variable Name* |
Basic |
Name for the scope variable to store the resulting string after append/prepend operation. |
||||
Advanced Mode* |
Basic |
Boolean parameter which can used to switch to advanced mode. Default value is false therefore by default processing element is in simple mode. In advanced mode an append template can be used to compose the new string. Read the description on append template parameter for more details on that. |
||||
Extraction Type* |
Basic |
Defines how the value which is to be subjected to append/prepend operation, is extracted from message context. This is an select type parameter and has following options to be selected from.
|
||||
Extraction Name |
Basic |
Depending on the selected Extraction Type, input for this parameter should vary as follows.
|
||||
Should Prepend* |
Basic |
Boolean parameter which determines whether to do an append operation or prepend operation. If this is set to true the operation will be prepend instead of append. Default value is false and hence the default operation is append.
|
||||
Appending/Pre-pending String* |
Basic |
String to be appended/prepended.
|
||||
String Append Template* |
Basic |
This parameter accepts a string append template which can be a plain text string can be a plain text string or any combination of expressions in following format.
A sample string append template is shown below.
Further following place holder can be used to get the current timestamp.
|
In integration flows sometimes there can be a requirement to send custom headers out with a request. One example would be to send a the flow name with the message id as a header. This sample use case will be used to demonstrate the String Appender processing element. The sample flow starts with a NIO HTTP Ingress Connector. Then we have the String Appender processing element, then a Logger, next aAdd Transport Header element and finally NIO HTTP Egress Connector to send the message out. The flow is as follows.
The responsibility of the String Appender processing element is to append the integration flow name to the message id and store it as a scope variable. Logger is simply used to log the scope variable saved by the String Appender element. The Add New Header element is used to add the newly created string scope variable as a transport header. Configuration for the String Appender is shown below. Note that here we have used the advanced mode for the element.