Mule 4 does not require
transformers anymore. Now that DataWeave is the default expression language and the repeatable streams feature is supported, most (if not all) scenarios that required a transformer no longer exist.
In Mule 3, the same data can be represented using different types. For instance, a JSON can be stored using a
ByteArray. In the same way, an XML can be represented with those same types or in a Java DOM document.
In Mule 4, every format that is not binary is handled automatically by Mule. So you do not need to be concerned about the type that is carrying the content.
In Mule 3, the
<object-to-string-transformer> was commonly used so that data held by an
InputStream could be consumed by more than one processor. Because Mule 4 has the concept of repeatable streams, this is no longer required.
To access the content of an XML or JSON document in Mule 3, a conversion to a Java object representation model was needed so that Java code or MEL could be used later. In Mule 4, the expression language of the runtime completely supports JSON and XML (and many other formats), so this conversion is no longer needed. You simply use a DataWeave expression to access the data.
Most likely, any custom transformers you used to handle supported data formats are no longer needed, so they can be migrated to use the expression language. The DataWeave script can be externalized to a file if the same transformation needs to be occur in several places.
For cases where you transform data in ways that DataWeave does not support, you should use the Java module or the Scripting module and use custom code to perform the transformation.