Thursday, February 23, 2017

Mule Dev Trick: Using Message Properties Transformer

The Abuse of set-variable

Many places I saw the code like the following:

Basically, developers set a bunch of flow variables for later usage. First of all, this kind of situation reflects design flaws. We should ask our selves why do we need to set so many flow variables? Can we use bean instead?

Use Message Property Transformer

Mule platform provide a very powerful transformer, namely message property transformer. Here is an example code:
        
            
            
            
            
            
            
        

The scope can be:
  invocation: flow variables
  outbound: property
  session: session variables
By using message property transformer, you can simplify the design, and make the flow easier to review.

3 comments:

  1. Unfortunately, Mulesoft has deprecated the message property transformer. They actually recommend the multiple set-variable transformers approach that you rightfully scorn in your upper flow.

    ReplyDelete
  2. Very informative post for mulesoft developers.You can also visit goformule.com for mulesoft stuff.

    ReplyDelete

Anypoint Studio Error: The project is missing Munit lIbrary to run tests

Anypoint Studio 7.9 has a bug. Even if we following the article: https://help.mulesoft.com/s/article/The-project-is-missing-MUnit-libraries-...