问题
Besides the syntax what is the core difference between a data mapper and payload factory? They both can convert/transform data from one format to another.
回答1:
I have used the data mapper only a few times (you stick with what you know). In my opinion both mediators provide mostly the same functionality (as does the xslt mediator) but the underlying technology and mainly the development method is radically different.
- datamapper provides a graphical way of transforming messages. It uses existing output and input messages to seed the transformation so it is strong when you have the output of service A and the input of service B and just need to map the data from A to B.
- payloadFactory is able to quickly build messages. I use it mostly to create requests where only a few fields need to be mapped from the original request to the new request.
- xslt is a versatile and powerful way of transforming messages but it requires some experience. A lot of 3th party tooling is available to assist with the transformation.
来源:https://stackoverflow.com/questions/54650230/difference-between-data-mapper-mediator-and-payload-factory-mediator