Why messages are immutable inside Biztalk?
Most of us know that messages received inside biztalk are immutable, meaning they cannot be modified. If we need to modify the message say for example, if you want to change the price of the product inside the message, then a new message needs to be constructed (Inside orchestration you use Construct, Transform shape etc, inside pipeline you create a temporary stream). So, whats the reason for this immutable message behaviour. Reasons:
1. A received message might have multiple subscribers (orchestration, sendports etc) means each subscriber of a particular message references the same, single copy of that message. So, it make sense the message is not modified by any single service like Orchestration or pipelines.
2. Since single copy is referenced by multiple subscribers, it minimize storage. ( A ref counter is maintained for each message and messages with ref count of 0 are periodically removed.)
3. The concept of messages being immutable also allows for detailed tracking of message state as messages flow through the system.