英文:
Correct way of using @Aggregator annotation with MethodInvokingMessageGroupProcessor
问题
在创建一个MethodInvokingMessageGroupProcessor(Object target)
时,将目标对象target
中所需的处理方法标记为@Aggregator
是否正确?或者这会导致创建一个无用的AggregatingMessageHandler对象?
英文:
When creating a MethodInvokingMessageGroupProcessor(Object target)
is it correct to annotate the desired processing method in target
with @Aggregator
or will this cause a useless creation of an AggregatingMessageHandler object?
答案1
得分: 1
这是正确的。这是MethodInvokingMessageGroupProcessor
及其MessagingMethodInvokerHelper
代理的逻辑:
public MethodInvokingMessageGroupProcessor(Object target) {
this.processor = new MethodInvokingMessageListProcessor<Object>(target, Aggregator.class);
}
虽然添加注释仍然是可选的,但为了帮助MessagingMethodInvokerHelper
,最好添加一个。
不,如果您的@Aggregator
没有inputChannel
属性,它不会创建额外的AggregatingMessageHandler
。
英文:
That's correct. That's the logic of that MethodInvokingMessageGroupProcessor
and its MessagingMethodInvokerHelper
delegate:
public MethodInvokingMessageGroupProcessor(Object target) {
this.processor = new MethodInvokingMessageListProcessor<Object>(target, Aggregator.class);
}
Although adding an annotation is still optional, it would be good to have to give that MessagingMethodInvokerHelper
a little help.
No, it does not create an extra AggregatingMessageHandler
, if your @Aggregator
doesn't come with an inputChannel
attribute.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论