Hi Solace Community,
It’s me again. So we moved from RabbitMQ to Solace and identified that Solace does not support batch mode.
See: Spring cloud stream batch mode — Solace Community
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.