Batch processing with Spring Cloud Stream

Hi Solace Community,

It's me again. So we moved from RabbitMQ to Solace and identified that Solace does not support batch mode.
See: https://solace.community/discussion/811/spring-cloud-stream-batch-mode

So we started to implement a manual Acknowledgement function to accomplish something similar. But we are stuck in one particular case where the messageCount is less than the batchSize.

For example, if the batchSize = 10 and there are 5 messages in the queue it doesn't trigger the minimum required messages for the upstream service.

So my question is there any way to find out the last message in the queue or get some information if there are any more messages in the queue?

Here you have a simplified code snippet of the problem.

    @Bean
    public Consumer<Message<ArticleTypeTwo>> articleConsumeSolace() {
        List<ArticleTypeTwo> articleList = new ArrayList<ArticleTypeTwo>();
        List<AcknowledgmentCallback> acknowledgment = new ArrayList<AcknowledgmentCallback>();

        return (msg) -> {

            AcknowledgmentCallback acknowledgmentCallback = StaticMessageHeaderAccessor.getAcknowledgmentCallback(msg); // (1)
            acknowledgmentCallback.noAutoAck();
            ArticleTypeTwo article = msg.getPayload();

            articleList.add(article);
            messageCount++;

            // Send articles in batch to portal
            if (batchSize == messageCount) {
                sendBatchToPortal(articleList, acknowledgment);
            }};
    }

Thanks a lot for your support.

Best Answer

  • amackenzie
    amackenzie Member, Employee Posts: 258 Solace Employee
    #2 Answer ✓

    We are looking at batch processing in the Solace binder and should likely have something in place in Q1 2022.

Answers

  • amackenzie
    amackenzie Member, Employee Posts: 258 Solace Employee
    #3 Answer ✓

    We are looking at batch processing in the Solace binder and should likely have something in place in Q1 2022.