0
votes

I'm sending messages to my message queue like this

 messages.forEach(message->
    sources.output().send(MessageBuilder.withPayload(message).build());

Those messages come from an external source and there could be thousands of them. I've seen the Splitter but it requires an input channel and output channel, but my messages are going into the queue for the first time, I'm just producing messages not consuming them, and I'm not sure how Aggregator would work or if it would be too complex for such a simple scenario.

So basically I'd like to be able to send those messages in batches, rather than one by one. How could that be accomplished?

1

1 Answers

0
votes

For something simple you can collect and create a List of data (messages or just payloads) and then create a single Message with List being a payload and send it.

For more configurable approach you can also use Spring Integration Aggregator