gpt4 book ai didi

java - spring 集成 inboundChannelAdapter 一次生成多条消息?

转载 作者:行者123 更新时间:2023-12-02 09:42:15 36 4
gpt4 key购买 nike

我尝试定义一个 InboundChannelAdapter 来从队列 API(本例中为 Azure)读取消息。 native 方法如下所示:

  @Bean
@InboundChannelAdapter(value = "myChannelExample",
poller = @Poller(fixedDelay = "1000",
maxMessagesPerPoll = "1"))
public MessageSource<QueueMessage> queueReadingMessageSource() {
return wrapMessage(queueClient.readMessage())
}

这按预期工作 - 但我想知道是否有一种更有效的方法来定义适配器,该适配器能够从消息源一次读取多个 (maxMessagesPerPoll>1) 消息?是否有允许返回消息列表的 messageSource 接口(interface)?

最佳答案

您只需返回一 strip 有 List<QueueSource> 的消息即可有效负载并在下游添加一个分离器。

关于java - spring 集成 inboundChannelAdapter 一次生成多条消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56972821/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com