-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-7925: Make message history header as mutable #8980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes: spring-projects#7925 The `MessageHistory.write()` creates not only a new instance of the `MessageHistory`, but also a new copy of the whole message. This significantly impacts the performance when we have too many components to track * Make `MessageHistory` as append-only container and create a new instance (plus message) only on the first track when no prior history is present * Change `WireTap`, `BroadcastingDispatcher`, `AbstractMessageRouter` and `AbstractMessageSplitter` to use a new `AbstractIntegrationMessageBuilder.cloneMessageHistoryIfAny()` API for every branch a message is produced. Essentially, create a new message with copy of the message history to let that downstream sub-flow have its own trace * Modify failed unit tests for a new logic where message history header is not immutable anymore * This also fixes an `AbstractMessageSplitter` for propagating its track into messages it emits
NOTE: Prior to version 6.3, the message history header was immutable (you cannot re-write history): every single track created not only new instance of the `MessageHistory`, but a fully new message copy. | ||
Now it works in append-only mode: the first track creates a new message with a new `MessageHistory` container. | ||
All the rest `MessageHistory.write()` calls add new entries to existing header - and no new message created. | ||
This significantly improves an application performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
instead of an
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is this application
in this context.
My thought was about any application which uses message history.
Maybe you meant the
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ya, i meant the
. sorry.
Now it works in append-only mode: the first track creates a new message with a new `MessageHistory` container. | ||
All the rest `MessageHistory.write()` calls add new entries to existing header - and no new message created. | ||
This significantly improves an application performance. | ||
All the components in the framework, where same message can be sent to several consumers (`PublishSubscribeChannel`, `AbstractMessageRouter`, `WireTap` etc.) (or splitter produces several outputs based on input message), are now cloning an existing `MessageHistory` header into those new messages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need for the parenthesis around the sentence, or splitter produces...
. Also or where splitter produces...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK to have several where
in the sequence?
I mean we already have one where
in the beginning.
This or
is just one more in the sequence.
So, might just no parenthesis and that's it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya, thats fine.
@artembilan Looks great based on our code walkthrough. Some very minor nit-picks on the docs. That's all. |
…blish * Fix typos in docs
The build is 🟢 . Thanks |
Fixes: #7925
The
MessageHistory.write()
creates not only a new instance of theMessageHistory
, but also a new copy of the whole message.This significantly impacts the performance when we have too many components to track
MessageHistory
as append-only container and create a new instance (plus message) only on the first track when no prior history is presentWireTap
,BroadcastingDispatcher
,AbstractMessageRouter
andAbstractMessageSplitter
to use a newAbstractIntegrationMessageBuilder.cloneMessageHistoryIfAny()
API for every branch a message is produced.Essentially, create a new message with copy of the message history to let that downstream sub-flow have its own trace
AbstractMessageSplitter
for propagating its track into messages it emits