Mule 3 Expression Improvements
Support for expression was introduced with Mule 2.2 in February 2009. This was new functionality that significantly simplified the use of filtering, transforming and routing using a single expression. Since the advent of cloud connectors expressions are heavily used to map from the messaging paradigm to the more RPC paradigm and select the values that will be used as parameters to invoke the connector.
While of great value over the time since expressions were introduced we have learnt about a number of issues in their usability, areas in which once improvement would greatly improve the usability of expressions in Mule.
Areas for Improvement
1) Syntax Consistency
Mule expression can be used in multiple places:
- Embedded within strings e.g. <logger message-""/> and endpoint 'address' attribute.
- Via expression/evaluator attributes on filter/transformer and other elements.
- Via a single 'expression' attribute on some other elements.
The attributes/syntax used in each of these places differs which is very confusing. Although we can't force consistency we can ensure that all places support a single syntax and that documentation/examples consistently uses a single consistent syntax.
2) Redundant 'Mule' expression evaluator.
Since Mule 2.2 there has been a 'Mule' expression evaluator. In theory this make the use of expression more fluent by providing a shortcut to various other expression evaluators. This isn't the case though as there is no auto-complete and this it's just provides a second way of using the other evaluators.
3) Context of Groovy Expression Evaluators
The groovy expression evaluator is widely used instead of other expression evaluators because of their limitations or in order to perform logic in an expression rather than simply extract a value. While
4) Expression Language
While the concept of having n expression evaluators with the ability to add custom evaluators is extensible it has a number of issues which all affect usability and in some cases the flexibility of use of expressions:
- The user needs to choose the appropriate expression evaluator
- It is not possible to compose expressions or compare result of two expressions
- The logic to compare values with literals is implemented in each evaluator. This means some don't support this and others are inconsistent.
A lot of people use the groovy expression evaluator to get around this, but this isn't that very intuitive and groovy has it's own issue.
All work done will be 100% backwards compatible. Documentation/examples will be updated to use the new approaches.
These changes will impact studio, not at the pallette level but rather in the configuration panes of components that have expression-powered attributes.
The documentation for Mule expressions needs an overhaul once this work is done. All examples/documentation that uses expression elsewhere may need to be updated.