4.4.2. Creation of a transformation
To create a transformation, just choose its type, and click on Create transformation
You can find all details about every type of transformation in the corresponding sections :
Gateway creation - Reuse confirmation
How to fail the message based on a value, then to close the error automatically.
In the transformation we will use the if statement to check for the condition then based on this condition the messages will be processed successfully or fail in error by using the fail() function.
Then we will create the extra processing of type "Automatically close errors" and provide the regex that will match this error message in order to be able to only close the messages that fail in this error.
1-In the transformation we will create a user defined metadata and named it for example "CheckTheMessage", Then we will provide the if condition for example in this case the message will fail in error when the "Address" field have the value of "MSG159", as shown below.
Note: The if condition can be used directly in any field in the "Message Out" if needed, and there is no need to create the user defined metadata.
2-In the transformation we will create extra processing of type "Automatically close errors" then we will click on the small + icon to add the regex that will match all of the error message if it is static (if needed) or parts of the error message if it is dynamic in order to only close the messages fail in this error, as shown below.
3-We can test this by test cases in the channel and only specific message will fail in error that will meet the condition and will be closed automatically, as shown below.