-
Notifications
You must be signed in to change notification settings - Fork 1.1k
INT-4571 Make MessageHandlerMethodFactory injectable #2688
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 still not OK do not have an out-of-the-box bean on the matter. And that would simplify a code in here, but at the same time pay attention, please, that we would like to use different argument resolvers for list case and non-list.
With the centralized single
IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME
we don't have such a distribution and proper logic here in the in this class.So, do we need to introduce an
IntegrationContextUtils.LIST_MESSAGE_HANDLER_FACTORY_BEAN_NAME
as well to cover this situation?If I'm alone in my "brain swamp", feel free to merge it and let's raise an issue to revise it in the next version!
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 am not sure i follow. . .
We do not need OOTB bean. As I said in the notes it's status quo unless. . and the unless part is where you decide to override at which point you register a bean of type and name specified.
Yes, there are quite a lot of additional improvements that can/should be done in this specific class and I've mentioned some of them, but the impact of introducing it now (minor release) may be more then we can/should allow.
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.
The problem is that with an explicit
IntegrationContextUtils.MESSAGE_HANDLER_FACTORY_BEAN_NAME
bean in your target application you apply it for all theMessagingMethodInvokerHelper
instances where some of them really should rely on thethis.canProcessMessageList
and the choice of argument resolves in your bean might be wrong or doesn't fit the list processing logic. I mean that with single global bean you are going to break something in your application without a way to reinstate the proper behavior.I might agree if you only apply such a global bean for those
MessagingMethodInvokerHelper
which are notthis.canProcessMessageList
though...Uh oh!
There was an error while loading. Please reload this page.
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.
Correct, if I override
MessageHandlerMethodFactory
I am taking full control. I have to take care of everything - as actually shown in test where there is only single resolver which accepts everything.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.
One more time: we have a special case for the
this.canProcessMessageList
.See
DefaultConfiguringBeanFactoryPostProcessor.internalArgumentResolversBuilder()
and its logic aroundlistCapable
parameter.I'm not sure that a single global bean can address that use-case. And that's definitely might be a case why we have fine-grained it into a separate
IntegrationContextUtils.LIST_ARGUMENT_RESOLVERS_BEAN_NAME
.Might the case that I just can't find the proper words to explain the issue...
@garyrussell , WDYT?
Uh oh!
There was an error while loading. Please reload this page.
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 agree that it would be better to pre-define standard beans for list and not-list case, and allow the user to override either one of them, or both; however, given the timing, and the fact we have to get 10 releases out today, I would tend to go with this compromise (SCSt doesn't need the list-capable invocation - that is generally for aggregation processors).
We can add an issue to the backlog to clean it up properly.
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.
OK. Then merging with simple code style polishing.
Uh oh!
There was an error while loading. Please reload this page.
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 would also make sure we revisit the lifecycle of
handleMethod
so it's only created when the actual instance ofMessageHandlerMethodFactory
is known.Now, with regard to standard beans for list and not-list case, I still believe it is out of scope for this issue and is the responsibility of the user who configures/overrides
MessageHandlerMethodFactory
to inject and configure the appropriate resolvers. IMHO it must beall or nothing
. As an example, I as a user who provides my own instance ofMessageHandlerMethodFactory
would never expect framework doing anything to it (injecting additional resolvers, etc) other then just using 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.
Done #2690