light_303
light_303

Reputation: 2111

spring integration inboundChannelAdapter produce more than one message at a time?

I tried to define an InboundChannelAdapter to read messages from a queue API (azure in this case). The native approach looks like this:

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

This works as expected - but I was wondering it there is a more efficient way to define an adapter which would be able to read multiple (maxMessagesPerPoll>1) messages at once from the message source? Is there a messageSource interface which allows returning a list of messages?

Upvotes: 0

Views: 370

Answers (1)

Gary Russell
Gary Russell

Reputation: 174809

You can simply return a message with a List<QueueSource> payload and add a splitter downstream.

Upvotes: 1

Related Questions