Announcement Announcement Module
Collapse
No announcement yet.
Publish-subscribe channel messages are passed by reference? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Publish-subscribe channel messages are passed by reference?

    Hi Integrators,

    I have a question about a publish-subscribe channel. It seems to me, that the very idea of this channel is to send a separate message to subscribed listeners, but what I see in my test project is that if one of the listeners attempts to change the incoming message, this change is propagated to all other listeners, so the message is passed by reference, not a separate copy created for every listener. Is it by design? Or am I missing something?

    Thanks in advance for your response!
    Last edited by maxvor; Oct 16th, 2012, 04:19 AM.

  • #2
    No; while the message itself is immutable, but the payload can be changed by other subscribers unless it, too, is immutable.

    The message simply holds a reference to the payload.

    If you want to leave the original payload unchanged, you need to clone it, perhaps in a transformer.

    Hope that helps.

    Comment

    Working...
    X