1.

What is a Mule transformer?

Answer»

A Mule transformer is used to strictly enforce the types of data it receives and its outputs. One CONFIGURATION can be used to relax this - An exception won’t be reported for bad input, but the original message will be returned without enforcing the expected result type by the transformer. Thus, this option should be used sparingly. A depiction of a Mule transformer is shown in the flowchart below. Mule has multiple transformers and each project you do might potentially have one transformer. 

There are different ways in which a transformer can alter a message:

  • Payload type transformation - In this, the message payload data type is transformed from one binary form to another. As an EXAMPLE, a java.util.Map can be transformed into a javax.jms.MapMessage.
  • Payload format transformation - In this, the message payload data format is transformed from one form to another. As an example, a byte array that has an XML document instance is transformed into a byte array that has a plain-text instance for logging.
  • Properties transformation - In this, the properties of the message are changed. This could be done by either adding, modifying or REMOVING existing properties. As an example, a message that requires a given property to be set PRIOR to being sent to a JMS destination.

Usually, transformers come in pairs. In these pairs, the second transformer cannot perform what the first one performs. 

As an example, the payload format transformations such as compression and decompression, are handled by 2 different transformers. One of these transformers is able to reverse the action of the other one. This is what is called a round-trip transformer. The original message should be restituted by making a message go through a transformer and its round-trip. 



Discussion

No Comment Found