Closed cortex93 closed 7 years ago
Hi @cortex93 - long story short: the reason that the dictionary isn't emptied is that there is no deterministic way to know when an context is no longer needed.
A bit of background: the message contexts are saved in the dictionary so that if the message handler is used to produce a new message, the received context is forwarded so that the information is passed to the next message handler. However, there are cases of concurrent message handing that makes it impossible to know if the context is expected to exist in order to keep the message context forwarding intact.
The message context forwarding is completely rewritten for 2.0, and has no longer this issue.
Hope this helps!
Oh didn't look that branch yet. Thanks for pointing it
No worries! I'm closing this ticket for now. Feel free to register a new issue if you find any other oddities 😉
I can't see where the MessageContext in MessageContextProviderBase is removed from ContextDictionary. After the message has been proceed, the MessageContext is still there.
Also, could you explain the reason behing this dictionary and having an AsyncLocal or TLS for keeping reference to globalMessageId ?