The order of the assign and transform in the Mediator

In my previous blogpost I pointed out the usage of an assign in a mediator component. This can be useful over the transform in several cases. Besides using one of the two, it is also possible to use them both in the same route. I would not advise using both the assign and the transform to manipulate the same data object, however this is possible.

If you want to do this, it is good to keep in mind in which order the mediator handles the manipulations. I used the same example from the previous blogpost and added an transformation in the mediator.

In the transform, I copy the firstname from the input, to the lastname of the output:

Resulting in both a transform and an assign in the mediator:

I deployed the service to the Enterprise Manager and will fire the following test:

The response already clarifies what happened here, the transform is fired first and only after the transform is done, the assign is being processed, because the input is the same as the output:

However, to verify this assumption, we will have a closer look at the flow trace, in the flow trace, we open the instance of the mediator:

In here we can clearly see that the xsl transformation is done before the assign.
Keep this in mind when you want to use both the transform as well as the assign option on the same data object in the mediator.

No comments:

Post a Comment