spring-boot-migrator
spring-boot-migrator copied to clipboard
Mule: Add ability to access headers during transformation
What needs to be done
Currently, DWL transformations are translated as below
Sample input
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
(flowVars.someVar splitBy ",") map ("'" ++ $ ++ "'") joinBy ","]]></dw:set-payload>
</dw:transform-message>
Generates following translation/output:
@Bean
IntegrationFlow transform() {
return IntegrationFlows.from(...)
...
.transform(TransformClass::transform)
...
.get();
}
class TransformClass {
/** contents of DWL transformation will be pasted as comments*/
public static TransformClass transform(Object payload) {
}
}
If you look at the above TransformClass there is only access to payload not headers
We need provision to access both headers and payload whilst transformation.
Why it needs to be done
In mule transformations, there will be instances where we need to access headers and payload whilst performing translations. This is evident from client applications that we have encountered where this pattern is used prolifically.
Additional Information
Possible solution can be found here.