...
The Multicast will copy the source Exchange and multicast each copy. However the copy is a shallow copy, so in case you have mutateable message bodies, then any changes will be visible by the other copied messages. If you want to use a deep clone copy then you need to use a custom onPrepare
which allows you to do this using the Processor interface.
Notice the onPrepare
can be used for any kind of custom logic which you would like to execute before the Exchange is being multicasted.
Tip | ||
---|---|---|
| ||
Its best practice to design for immutable objects. |
For example if you have a mutable message body as this Animal class:
...